如何从ASP.NET身份验证中省略或转义页面 [英] How to Omit or escape a page from ASP.NET Authentication

查看:75
本文介绍了如何从ASP.NET身份验证中省略或转义页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个Web应用程序.
我使用了Forms身份验证,并将Login.aspx设置为登录URL.
因此,当我尝试在地址栏中输入其他任何页面网址时,Iam会根据其设置重定向到登录"页面.

但是现在我需要在Login.aspx页面中提供一个名为 Register 的链接.
单击注册"链接应将我带到Register.aspx页面.
但是根据身份验证设置,我将重定向到登录"页面.

那么,有什么方法可以从此身份验证设置中忽略或退出register.aspx页吗?

在此先感谢您.

Hi every one

I have a web application.
I used Forms authentication and set Login.aspx as the Login url.
So when I try to enter any other page url in my address bar Iam redirected to Login page as per its setting.

But now I need to give a link called Register in Login.aspx page.
Clicking on Register link should take me to Register.aspx page.
But as per authentication settings I am redirected to Login page.

So is there a way to omit or escape the register.aspx page from this authentication setting?

Thanks in advance.

推荐答案

在您的web.config中添加以下内容

Add following in your web.config

<location allowOverride="true" path="Register.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>



如果正确,请接受答案



Accept answer if it is correct


似乎您是第一次使用SQL身份验证;).
SQL身份验证是我的最爱.它减少了很多有关身份验证和授权的代码工作.

解决该问题的方法是无需身份验证即可提供对要显示的网页的显式访问.只需在 Web.Config 中添加以下行,就可以开始了:

在< configuration>下,标签在下面的行中输入-
It seems you are playing with the SQL Authentication for the first time ;) .
SQL Authentication is my favorite. It reduces lot of your code work regarding authentication and authorization.

The solution to your problem is providing explicit access to the webpage you want to show without authentication. Just add below lines in your Web.Config and you are ready to go:

Under the <configuration> tag enter below lines-
<location path="File Path">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>


这篇关于如何从ASP.NET身份验证中省略或转义页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆