Once set up webconfig to connect to the database. The link to the main page stopped working. When I go to the Register.aspx page, it simply returns a string in the address bar http: // localhost: 4643 / Default.aspx? ReturnUrl =% 2fRegister.aspx. The reason, it seems to me, lies in this line of settings. How can I solve my problem?

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

Here is the code for my page. The link with the name "register" does not work

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="webchat.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <h2> Вход в чат</h2> <p> <asp:Login ID="Login1" runat="server" BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"> <TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" /> </asp:Login> </p> <p> <asp:LoginView ID="LoginView1" runat="server"> <AnonymousTemplate> Авторизируйтесь пожалуйста или <a href="Register.aspx">зарегистрируйтесь</a> </AnonymousTemplate> <LoggedInTemplate> Добро пожаловать, <asp:LoginName ID="LoginName1" runat="server" />.<br /> <asp:HyperLink ID="HyperLink1" runat="server" Text="Войти в чат" NavigateUrl="~/Chat/ Default.aspx "></asp:HyperLink><br/> <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/ ChangePassword.aspx ">Изменение пароля</asp:HyperLink> </LoggedInTemplate> </asp:LoginView> </p> <p> <asp:LoginStatus ID="LoginStatus1" runat="server" /> </p> <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="Login1"/> <p> </p> </form> </body> </html> 

    2 answers 2

    In web.config, unauthorized users should be allowed access to the ~/ Register.aspx page:

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

      Maybe I'm wrong, but isn't it instead of Register.aspx ~/ Register.aspx ?