Results 1 to 2 of 2

Thread: Why! Why! I keep getting returned back to my login page.

  1. #1

    Thread Starter
    Addicted Member DigitalMyth's Avatar
    Join Date
    Nov 2002
    Location
    England..
    Posts
    169

    Why! Why! I keep getting returned back to my login page.

    For some reason i keep getting kicked back to my login page and i can't for the life of me work out WHY!

    VB Code:
    1. <%@ trace="true" %>
    2. <script runat="server">
    3.  
    4.    Sub Page_Load
    5.     Dim checkstr as string
    6.     checkstr = Request.QueryString("action")
    7.     If User.Identity.ISAuthenticated = "false" then
    8.         If not Request.QueryString("action") = "login" then
    9.             Response.Redirect("default.aspx?action=login")
    10.         end if
    11.     end if
    12.    End Sub
    13.  
    14.  
    15.    Sub Button_click
    16. Trace.Write( " txtUsername.text = " & txtUsername.text )
    17. Trace.Write( " txtPassword.text = " & txtPassword.text )
    18.     If txtUsername.text = "So" and txtPassword.text = "So" then
    19.    
    20.     FormsAuthentication.RedirectFromLoginPage( txtusername.text, chkRemember.Checked )
    21.        
    22.     else
    23.    
    24.     Response.Redirect("default.aspx?action=summ")
    25.        
    26.     End If
    27.    End sub
    28.  
    29. </script>
    30.  
    31. <% Select Case Request.QueryString("action")
    32.  
    33. Case "login"%>
    34.  
    35.  
    36. <html>
    37. <head><title>default.aspx?action=login</title></head>
    38. <body>
    39. <form Runat="Server">
    40.  
    41. <h2> Please Login: </h2>
    42.  
    43. <asp:Label
    44.   ID="lblMessage"
    45.   ForeColor="Red"
    46.   Runat="Server" />
    47.  
    48. <p>
    49. <b>Username:</b>
    50. <br>
    51. <asp:textbox
    52.  ID="txtUsername"
    53.  Runat="Server" />
    54. <p>
    55. <b>Password:</b>
    56. <br>
    57. <asp:textbox
    58.  ID="txtPassword"
    59.  Runat="Server" />
    60. <p>
    61. <asp:checkbox
    62.  ID="chkRemember"
    63.  Runat="Server" />
    64. Remember me with a cookie?
    65. <p>
    66. <asp:button
    67.   Text="Login!"
    68.   Runat="Server" />
    69.  
    70. </form>
    71.  
    72. <% Case "filelist" %>
    73.  
    74. <% Case "fileupload" %>
    75.  
    76. <% Case Else
    77.  
    78. Response.Redirect("Action is Null") %>
    79.  
    80. <% End Select %>


    DEFAULT.ASPX


    VB Code:
    1. <configuration>
    2.   <system.web>
    3.     <authentication mode="Forms">
    4.       <forms
    5.         name=".ASPXAUTH"
    6.         loginUrl="Default.aspx?action=login"
    7.         protection="All"
    8.         timeout="80"
    9.         path="/"/>
    10.       </authentication>
    11. <authorization>
    12. <deny users="?" />
    13. </authorization>
    14. <compilation debug="true"/>
    15.   </system.web>
    16. </configuration>

    WEB.CONFIG

    Also i want all log-in's to go to

    efile.aspx?action=summ

    can some help me on this to?

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Stupid question, have to ask it, sorry:

    Are you typing the address of your login page in the browser, or the page you want to go to? It should be the page you want to go to, and if that wasn't passed, it should default to whatever page you set.

    Also, You are trying to redirect from the login page, even though the user was never authenticated, which is why it probably keeps kicking you back to the login page.
    Code:
    If txtUsername.text = "So" and txtPassword.text = "So" then
    	
       'YOU NEED TO SET AN AUTHORIZATION TICKET HERE
    	FormsAuthentication.RedirectFromLoginPage( txtusername.text, chkRemember.Checked )
    		
    	else
    	
    	Response.Redirect("default.aspx?action=summ")
    		
    	End If
    Last edited by nemaroller; Mar 31st, 2004 at 07:07 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width