Click here to Skip to main content
14,733,443 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I was creating login page rearging to the course on Role-based Security with Forms Authentication[^] but my returnUrl is always null. Can someone give me some tips how to solve that problem?
Here the code where the problem is occurring:
string returnUrl = Request.QueryString["ReturnUrl"];
                    if (returnUrl == null) returnUrl = "AboutUs.aspx";  Response.Redirect(returnUrl);
Posted
Updated 31-Oct-14 23:34pm
v4
Comments
abhijeetgupta1988 1-Nov-14 4:32am
   
After successful login you should redirect your user to defualt page or Dashboard page.
DamithSL 1-Nov-14 4:41am
   
how you test? run your create breakpoint on above line and run your website, if you already login to site, first log off and write some other url(don't enter login page and default page url), now what is the value you get as return url?
Member 11187739 1-Nov-14 5:22am
   
I am starting to learn how to write web pages so my tests are quite simple. I am tesing it by displaying messageLabel texts in my code in method btnLogin_Click. Then I see that my rader reads data and enters to the if statement. I also change returnUrl to different pages eg. instead of AboutUs I put Rooms, Contact etc and it always returns to this page which I entered.
I created brakepoint on above line and my resutl was the same - redirects me to page which I eneterd. Maybe it will be stupid question but by writing "don't enter login page and default page url" you ment not to write it in web.config?

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