表单身份验证和 Web 表单

发布于 2024-10-02 03:57:42 字数 1059 浏览 0 评论 0原文

我有一个目录,我想允许仅登录的用户。根目录下还有一个网页,其中包含一些数据,所有访问者都可以看到它们。 Web.config 文件:

<system.web>
    <compilation debug="true"/>
    <customErrors mode="Off"/>
  <authentication mode="Forms">
    <forms name=".Artucltd" loginUrl="loginpage.aspx"
        protection="All" path="the_path" timeout="30" 
        cookieless="UseDeviceProfile" />
  </authentication>
  <authorization>
    <deny users ="?" />
    <allow users="*"/>
  </authorization>
</system.web>

这是自定义登录,控制来自 MSSQL 2008 数据库的用户名和密码。一切正常,但我有一个问题:

当我想打开默认网页(http://localhost/test)时,系统会自动重定向到loginpage.aspx(而不是Default.aspx)。但我想查看 Default.aspx 并导航到其他页面。 Loginpage.aspx 位于不受保护的根文件夹中,我想这样做。在受保护的文件夹中,还有另一个Default.aspx页面和其他受保护的页面。我怎样才能摆脱这个重定向?我应该将此受保护的文件夹指定为应用程序并放置另一个 Web.config 文件吗?

我到目前为止尝试过的进程:

  • 更改了受保护文件夹中的 Default.aspx 页面的名称

  • 在 IIS 中,默认页面是 Default.aspx< /p>

  • 在 Visual Studio 2010 中,我将默认页面设置为根文件夹中的 Default.aspx。

但没有运气!

I have a directory and I want to allow users which are only logged into. Also there is a web page in root directory which has several data and all visitors can see them. Web.config file:

<system.web>
    <compilation debug="true"/>
    <customErrors mode="Off"/>
  <authentication mode="Forms">
    <forms name=".Artucltd" loginUrl="loginpage.aspx"
        protection="All" path="the_path" timeout="30" 
        cookieless="UseDeviceProfile" />
  </authentication>
  <authorization>
    <deny users ="?" />
    <allow users="*"/>
  </authorization>
</system.web>

This is custom login which controls username and password from MSSQL 2008 database. Everything works fine but I have a problem which is:

When I want to open default web page (http://localhost/test), system is automatically redirect to loginpage.aspx (not to Default.aspx). But I want to see Default.aspx and navigate to other pages. Loginpage.aspx is in root folder which is not protected and I want to do it same. In protected folder, there is another Default.aspx page and other protected pages. How can I get rid of this redirection? Should I specify this protected folder as application and put another Web.config file?

Processes that I tried up-to-now:

  • Changed name of Default.aspx page in protected folder

  • in IIS, default page is Default.aspx

  • in Visual Studio 2010, I set default page as Default.aspx in root folder.

But no luck!

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

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

发布评论

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

评论(1

耶耶耶 2024-10-09 03:57:42

好吧,我找到了解决方案:http://support.microsoft.com/kb/316871

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