Click here to Skip to main content
15,348,882 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I wonder if anyone can help me with this issue.


In my application when I log in, I create session variables to store the username.

C#
protected void btnLogin_Click(object sender, EventArgs e)
       {
           if (validateUser() == true)
               Response.Redirect("~/Default.aspx");
       }


C#
private bool validateUser()
      {
          if()
          {
              Session["User"] = objU.Username;
              return true;
          }
          else
              return false;
      }


When I run the app and login, the validate user funtion works fine and returns true as it finds the user, but instead of taking me to the default page I get redirected back to the login page with this URL on the browser
http://localhost:55197/Login.aspx?ReturnUrl=%2fDefault.aspx[^]

Also, I keep getting the error in between.

Microsoft JScript runtime error: '$' is undefined

Can anyone please shed some light on what is happening ?

Thanks.
Posted
Updated 1-Jun-11 22:04pm
v2
Comments
[no name] 2-Jun-11 2:58am
   
It looks like you are not really logged in and that's why you are redirected to the login page
AnnSJ 2-Jun-11 3:12am
   
no.. teh validate user function does validate and comes into Response.Redirect("~/Default.aspx"); but instead i get taken back to log in page.
[no name] 2-Jun-11 4:31am
   
Is there an action in the default.aspx that is causing this?
AnnSJ 2-Jun-11 4:36am
   
none.. we made soem changes in oiurlog in screen. reverted back .. n its working now..
thanks.

Hi
It looks like you have some authorization issues in your application. Visit this may help you.
Click Here[^]
   
v2
hi
C#
protected void btnLogin_Click(object sender, EventArgs e)
       {
           if (validateUser() == true)
               Response.Redirect("Default.aspx");
       }



try this if problem occurs please post it
   
i think u are not ABBEND THE SESSION VALUE.
FIRSTLY ABBEND THE SESSION VALUE OHERWISE U CAN USE THIS CODE AT
LOG OUT PAGE

SESSION["VALUE"]=NULL;

THEN ALL PAGE_LOAD EVENT USE THIS LIN

IF(SESSION["VALUE"]!=NULL)
{
RESPONSE.WRITE("USER LOGIN SUCCESSFULLY");
}
ELSE
{
RESPONSE.REDIRECT("LOGIN_FAIL_PAGE.ASPX");
}
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900