我在web.config里申明了验证模式如下:
<authentication mode="Forms">
<forms name=".ASPXCOOKIE" loginUrl="index.aspx" protection="All" timeout="30" />
</authentication>IIS也设置成匿名可访问了,但当前第一次打开不是index.aspx的时候,它并不跳转,真郁闷,是不是在代码里还要做判断? 应该不要吧?
<authentication mode="Forms">
<forms name=".ASPXCOOKIE" loginUrl="index.aspx" protection="All" timeout="30" />
</authentication>IIS也设置成匿名可访问了,但当前第一次打开不是index.aspx的时候,它并不跳转,真郁闷,是不是在代码里还要做判断? 应该不要吧?
方法1:
<authentication mode="Forms">
<forms name=".ASPXCOOKIE" loginUrl="index.aspx" protection="All" timeout="30" />
<!-- 这里设置不允许匿名访问的路径 -->
</authentication>方法2:在需要验证的页面装载的时候,判断用户是否通过验证,如果没有,使用Response.Redirect方法跳转。
方法跳转。