首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

令小弟我崩溃的asp有关问题

2013-01-23 
令我崩溃的asp问题我有一应用,本在asp.net下运行正常,后因涉及的信息内容原因要搞成单机版,于是找来一破旧

令我崩溃的asp问题
我有一应用,本在asp.net下运行正常,后因涉及的信息内容原因要搞成单机版,于是找来一破旧电脑安装windows 2003,遗憾的是原来.net下的东西老出问题:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
在网上翻了无数资料,均以失败而告终。
于是把一些代码改成asp,这回更让我糊涂:

  IF (LEN(Session("UserName"))=0 Or LEN(Session("UserLevel"))=0) THEN
      Response.Write Session("UserName") & " : "
  Response.Write LEN(Session("UserName")) & "<BR>"
  Response.Write Session("UserLevel") & " : "
  Response.Write LEN(Session("UserLevel"))
  'Response.Redirect "../NORIGHT.htm"
  ELSE

明明LEN(Session("UserName"))为3,LEN(Session("UserLevel"))=6 可是就是要THEN之后的代码,而不是ELSE后面的代码!谁能告诉我为啥?
环境为Windows 2003 SP2, .NET 为4.0
[解决办法]
看你的代码,执行ELSE后的代码是对的啊!
[解决办法]
先把Session("UserName")和Session("UserLevel")输出,看一下有没有内容
[解决办法]
你反向尝试下如何
IF (LEN(Session("UserName"))<>0 and LEN(Session("UserLevel"))<>0) THEN

ELSE
     Response.Write Session("UserName") & " : "
     Response.Write LEN(Session("UserName")) & "<BR>"
     Response.Write Session("UserLevel") & " : "
     Response.Write LEN(Session("UserLevel"))
     'Response.Redirect "../NORIGHT.htm"

[解决办法]
Response.Write Session("UserName") & " : "
Response.Write Session("UserLevel") & " : "
把这条语句放在IF前,然后再运行一下,看是不是有值
[解决办法]
这根本不是问题,ASP本身就有时会出问题的.

比如:
if a=3 then
b=5
else
b=6
end if

上面的最简单,但当a=3时,B的结果却是6。所以5楼的可以试一下。
if a<>3 then
b=6
else
b=5
end if
这样写就可以了。没什么,经常的应该知道这类的问题。

热点排行
Bad Request.