需要在不登录的情况下显示页面(asp.net)

发布于 2024-08-29 06:16:55 字数 342 浏览 4 评论 0原文

我正在使用

<authentication mode="Forms" >
  <forms loginUrl="login.aspx"
    name=".ASPXFORMSAUTH"  />
</authentication>

一切正常,除了有一些页面,如关于我们、联系我们、隐私政策等,不需要登录即可查看。

就我而言,我需要登录才能查看所有页面。我希望无需登录即可查看这些常见页面。

我已经在本地 IIS 和部署服务器上测试了我的应用程序,但出现了同样的问题。

请帮忙!

感谢您分享您的宝贵时间。

I am using

<authentication mode="Forms" >
  <forms loginUrl="login.aspx"
    name=".ASPXFORMSAUTH"  />
</authentication>

Every thing works fine except that, there are some pages like About Us, Contact Us, Privacy Policy etc, which do not need to login to view them.

In my case i need to login to view all pages. I want these common pages to be viewable without having to log on.

I have tested my application on local IIS as well as on deployment server, but same problem occurs.

Please help!

Thanks for sharing your valuable time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜嗑 2024-09-05 06:16:55

您需要为安全策略创建例外:

<!-- files in the "Public" folder don't require authorization -->
<location path="Public">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

或者,您可以创建特定于页面的例外:

<location path="AboutUs.aspx">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

You need to create exceptions to your security policy:

<!-- files in the "Public" folder don't require authorization -->
<location path="Public">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

Alternately, you can make page-specific exceptions:

<location path="AboutUs.aspx">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>
黑色毁心梦 2024-09-05 06:16:55

显然,您希望某些页面无需登录即可使用。解决此问题的方法是在子目录而不是网站根目录上设置权限,并将这些页面放在网络根目录中(通常它们位于根目录中)

如果这太多了工作时,将您的页面放入目录中并允许匿名用户访问它。

Appearantly you want some pages to be available without logging in. The way to go about this is to set permission on subdirectories instead of the website root, and put these pages in the web root (usually they are in teh root)

If thats too much work, put your pages in a directory and allow anonymous users to access it.

长途伴 2024-09-05 06:16:55

对于这样一个悬而未决的问题,可能有很多可能的答案。我们需要更多细节来回答。以下是一些需要查看的地方:

您是否检查过 web.config 文件以查看匿名身份验证是否已关闭?

您是否检查过 web.config 以查看是否拒绝匿名用户访问您的根目录?

您是否检查过 IIS 以查看匿名身份验证是否已关闭?

您是否检查过页面的源代码文件以查看是否对匿名用户进行手动拒绝服务?

There could be a large number of possible answers to such an open question. We will need more specifics to answer. Here are just a few places to look:

Have you checked your web.config file to see if anonymous authentication is off?

Have you checked the web.config to see if you are denying anonymous users access to your root directory?

Have you checked IIS to see if anonymous authentication is off?

Have you checked the pages' source code files to see if you are doing manual denial of service to anonymous users?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文