c# - Return URL not working in link -


i using asp.net , having problems redirecting the original requested url after login. url showing in address bar when signing it takes me default.aspx every time:

http://development-4/login.aspx?returnurl=%2fcontrols%2ffinancial%2faddressbook.aspx 

the .net framework handles automatically redirecting using 'returnurl' value. unless you're taking user somewhere other attempted go, use following redirect them requested page.

replace 'username' username provided while logging in. 'ispersistant' refers whether cookie should persist browser sessions or deleted when window closed.

formsauthentication.redirectfromloginpage("username", ispersistant);  

if have chosen take user somewhere else, code should similar this.

formsauthentication.setauthcookie("username", ispersistant); response.redirect("~/somepage.aspx"); 

because didn't provide background information, i'll add following config. should have similar.

<system.web>     <authentication mode="forms">         <forms name="logincookiename" loginurl="~/login.aspx" protection="all" timeout="60" path="/" />     </authentication>     <authorization>         <deny users="?" />     </authorization> </system.web> <location path="login.aspx">     <system.web>         <authorization>             <allow users="*" />         </authorization>     </system.web> </location> 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -