FormsAuthentication.RedirectFromLoginPage reload page

久未见 提交于 2020-01-07 06:58:05

问题


I am using the .Net memebership system, and uptil now I haven't had any real troubles with it. I now have a overlay where a user can create a profile. When the profile is created I just want to redirect to the same page, and not to the default page or the return url - which doesn't exists.

I have tried to stop the FormsAuthentication.RedirectFromLoginPage response, but with no effect:

 FormsAuthentication.RedirectFromLoginPage(username, false);
 // End the redirect so it doesnt redirect to default url (front-page)
 Response.End();
 Response.Redirect(Request.RawUrl);

Does anyone have an idea to how this can be solved?


回答1:


Use this instead:

FormsAuthentication.SetAuthCookie(username, false);
Response.Redirect(Request.RawUrl);


来源:https://stackoverflow.com/questions/1939330/formsauthentication-redirectfromloginpage-reload-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!