本文介绍了尝试使字符串变暗并获得“预期的语句结尾"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的网站获得了一个新域名,以前是SomeOldWebsiteURL.com,现在是NewWebsite.com,下面是我放置在旧服务器上的重定向页面的HTML.

我的整个重定向页面如下.这必须在Classic ASP和VBScript中完成,我别无选择.

I got me a new domain name for my website and it used to be SomeOldWebsiteURL.com, now it''s NewWebsite.com and the below is the HTML for the redirect page I am placing on my old server.

My whole little redirect page is the following. This HAS to be done in Classic ASP and VBScript, I have no choice there.

<%
	Dim str As String = HttpContext.Current.Request.Url.Host

	If (String.Compare(HttpContext.Current.Request.Url.Host, "SomeOldWebsiteURL.com", True) = 0) Then
		Response.Redirect("index.asp")
	End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
</head>
<html>
<body>

</body>
</html>



当我尝试运行此命令时,在行Dim str As String上收到语句的预期结尾"错误.有人对我可能做错了什么建议吗?

提前谢谢!

Brian



When I try to run this, I get an "Expected end of statement" error on the line Dim str As String. Does anybody have a suggestion as to what I might be doing wrong?

Thanks in advance!

Brian

推荐答案

Dim str As String = HttpContext.Current.Request.Url.Host




with

Dim str
str = HttpContext.Current.Request.Url.Host



顺便说一句,您实际上在剩余的代码中没有使用str.



BTW you actually are NOT using str in the remaining code.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
</head>
<html>
<body>

<%
	Dim str As String = HttpContext.Current.Request.Url.Host

	If (String.Compare(HttpContext.Current.Request.Url.Host, "SomeOldWebsiteURL.com", True) = 0) Then
		Response.Redirect("index.asp")
	End If
%>

</body>
</html>



这篇关于尝试使字符串变暗并获得“预期的语句结尾"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 13:54