asp.net 4.0:加载URL时出错
对不起,我是ASP.NET的新手 我已经写了这个页面,但是当我运行它时,虽然浏览器中的URL是正确的,但它会转到登录页面。你知道为什么会这样吗 代码是:asp.net 4.0:加载URL时出错,asp.net,url,Asp.net,Url,对不起,我是ASP.NET的新手 我已经写了这个页面,但是当我运行它时,虽然浏览器中的URL是正确的,但它会转到登录页面。你知道为什么会这样吗 代码是: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="root_VerifyUsers.aspx.cs" Inherits="Library.Account.root" MasterPageFile="~/Root.Master" %> <asp:Con
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="root_VerifyUsers.aspx.cs"
Inherits="Library.Account.root" MasterPageFile="~/Root.Master" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<p>
<h1>
Verify Users
</h1>
</p>
<asp:Login ID="VerifyUser" runat="server" EnableViewState="false" RenderOuterTable="false">
<LayoutTemplate>
<div class="accountInfo">
<p>
<asp:ListBox ID="ListBox1" runat="server" Width="100%" Height="100%"></asp:ListBox>
</p>
<p>
<asp:Button ID="LoginButton" runat="server" Text="Log In"
ValidationGroup="LoginUserValidationGroup" onclick="LoginButton_Click"
Width="691px" Height="48px"/>
</p>
</div>
</LayoutTemplate>
</asp:Login>
</asp:Content>
您的代码似乎显示了我看到的登录页面。你应该得到一个登录页面。我在这里跳枪,因为你的问题缺少我们需要回答的很多信息。然而,作为一个总在黑暗中刺;打开web.config文件,查看其中是否有类似的内容:
<authentication mode="Forms">
<forms name="Foo" loginUrl="/Login.aspx">
</forms>
</authentication>
你们有类似上面的东西吗?可能是您的网站启用了身份验证,这意味着,由于您未登录该网站,它会重定向到登录页面
编辑:
好的,这是你的问题:
http://localhost:21266/Account/Login.aspx?ReturnUrl=%2fAccount%2froot_VerifyUsers.aspx
您的url实际上将http://localhost:2166/Account/Login.aspx
这是登录页面。登录网站后,通过提供有效的用户名和密码,您将被重定向到http://localhost:2166/Account/froot_VerifyUsers.aspx
,它是url的返回url
部分
因此,您的站点中100%都有身份验证设置。我的身份验证设置技能相当差,因此我无法真正帮助您配置。但是我相信其他SO用户可以提供帮助,或者至少有很多关于ASP.NET身份验证的SO问题您可以搜索。您需要显示隐藏的代码。@Yosi隐藏的代码中没有任何内容,但我添加了它您在浏览器中使用的url是什么?请给我们看一下好吗?请让我们知道到底发生了什么,您是否尝试浏览任何应用程序页面,但被重定向到登录页面?请查看母版页(如果编写了任何授权代码)或web.config,如@JasonEvansGlad所建议,我可以帮助好友:)
<authentication mode="Forms">
<forms name="Foo" loginUrl="/Login.aspx">
</forms>
</authentication>