Skip to content

Can not redirect page

linda

Asked Aug 3, 2009, 5:34 AM EDT3 answers
Share
LinkedInX
I have my login page is working, I can connect to the db server and check user, Looks like this. int i = database.DBStore1.ReturnDB("select * from users where username='" + Username.Text.Trim() + "' and Password='" + Password.Text.Trim() + "'"); if (i > 0) { Session.Add("username", Username.Text); msglbl.Text = "Successfully Login"; Response.Redirect("default.aspx"); } else { msglbl.Text = "Invalid user name or Password!
Please Enter Again"; } } Above code works, except I can not direct to default.aspx (the url shows as) http://localhost:2253/test/Login.aspx?ReturnUrl=%2ftest%2fdefault.aspx any idea why I can't see default.aspx Thank you

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Niradhip Chakraborty
    0

    Check Out the code inside default.aspx. You need to open the .cs file of default.aspx and check the code in pageload. You may redirecting to Login page automatically from default.aspx page.

    0
  • 0
    Thank you, I don't have anything on that page (no onload) is web.config has anything with this problem, I mean sesions !! Even I added new webform blank, and redirect, nothing. just blinks and return to login page. hope someone can help. thanks
    0
  • Niradhip Chakraborty
    0

    If I understood your problem,as per your code if login is successful you are redirecting to default page and instead of default.aspx you are redirecting to http://localhost:2253/test/Login.aspx?ReturnUrl=%2ftest%2fdefault.aspx this page. This means somewhere in default.aspx you are redirecting to Login.aspx page.

    I don't think session will come into picture here because as you mentioned you don't have any pagebehind code in default.aspx page. Check out the head tag.

    Are you using something like this in head tag of html page?

     

    <head runat="server">

        <title>WebRental</title>

                <META HTTP-EQUIV="Refresh" CONTENT= "0; URL="test/Login.aspx?ReturnUrl=%2ftest%2fdefault.aspx "/>

               

    </head>

    0