Retain Url Fragment within ReturnUrl in Forms Authentation under MVC

风流意气都作罢 提交于 2019-12-06 07:53:55

Is there a way to retain this url fragment so it doesn't get lost during the login phase?

No, there isn't. The url fragment is never sent to the server. One possibility is to modify the returnUrl on the client before passing it to the server so that the url fragment becomes part of the query string. Then when the login succeeds and the server needs to redirect back to the returnUrl it would modify it to the original value.

For example it might look like this before sending it to the Login method:

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