表单身份验证的ReturnUrl问题 [英] ReturnUrl issue with form authentication

查看:79
本文介绍了表单身份验证的ReturnUrl问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在使用Asp.net 4.0 c#

我在首页上遇到重定向问题.
到底发生了什么
我正在使用功能创建新网站
-表单身份验证
-自定义角色提供者
-网站地图(来自web.sitemap)
该站点已正确构建和调试.
我的要求是,任何人访问该站点时,他都应该能够看到home.aspx(站点的主页),但是
当我运行该站点时,它重定向到login.aspx(站点的登录页面),并且我的URL变为
"http://localhost:1552/aspx/Login.aspx?ReturnUrl =%2faspx%2fHome.aspx"

此外,母版页未与其CSS一起应用,仅显示母版页的内容.

用于表单身份验证的Web.config文件更改为

Hello everyone,
I m working on Asp.net 4.0 c#

I am facing issue with redirecting on home page.
What exactly happening
I am creating a new site with the functionality
- form authentication
- custom role provider
- site map (from web.sitemap)
The site is build and debug properly.
And my requirement is when any one visit to site he should able to see the home.aspx (home page of Site)but
when i am running the site it''s redirecting to login.aspx(login page of site) and my URL becomes as
"http://localhost:1552/aspx/Login.aspx?ReturnUrl=%2faspx%2fHome.aspx"

Also the master page is not applying with its CSS, only the content of master page is displaying.

Web.config file changes for form authentication are

<authentication mode="Forms">
    <forms defaultUrl="~/aspx/Home.aspx"  loginUrl="~/aspx/Login.aspx"  timeout="60"/>
  </authentication>



#对于站点地图,Web.config更改为



# For sitemap, Web.config changes are

<siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">
      <providers>
        <clear />
        <add name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

     siteMapFile="web.sitemap" securityTrimmingEnabled="true"  />
      </providers>
    </siteMap>

    <authorization>
      <deny users="?" />
    </authorization>



对于身份验证,我有两种类型的用户1.来自admin和另一位来宾
对于那里的aspx页面,我已经单独创建了文件夹结构,并且在web.config中,我在该位置提供了



And for authentication i have 2 type of user 1. from admin and another one guest
for there aspx page i have separately create the folder structure and in web.config i provide there location as

<location path="aspx/_admin">
   <system.web>
     <authorization>
       <allow roles ="admin"/>
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>
 <location path ="aspx/_guest" >
   <system.web>
     <authorization>
       <allow roles="guest" />
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>



我认为该问题与表单身份验证有关,或者可能是由于我在web.config文件中指定的位置标记导致的.
迫切要求,最后期限太短了.如果有人知道解决方案,请帮帮我.



I think the issue is related to form authentication or may be due to the location tag which i have specified in web.config file
Its a urgent requirement, the dead-line is too short. please help me if any one knows the solution

推荐答案

也请在web.config中添加一个部分.

Also add a section in web.config.

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


这篇关于表单身份验证的ReturnUrl问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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