MVC C# activation url redirects to other path

自闭症网瘾萝莉.ら 提交于 2019-12-11 19:37:03

问题


I have code that i used a year or two ago to create an activation link that is send by email, using a code as a parameter, i tried so many different ways, encoding, using other syntax, adding web.config settings <pages validateRequest="false" /> requestValidationMode="2.0" , annotations [AllowHtml], literally tried dozen of post on the internet but none of them worked.

So i am overseeing something here, that i am sure but i can't find the solution.

The error i get is: A potentially dangerous Request.Path value was detected from the client (?)

The format i use is

Url.Action("action","controller", new { Id = guidValue }, Request.Url.Scheme)

My routing is the Default so this should work.

The Url is like this in the address bar once clicked:

http://localhost:52641/Account/Login?ReturnUrl=%2FAccount%2FAccountActivation%2F%3Fid%3Dfc39f53f-6fa7-43d2-b30a-8b4e20f0f237

While it should give me:

http://localhost:52641/Account/AccountActivation?id=fc39f53f-6fa7-43d2-b30a-8b4e20f0f237

What is happening here? Thank you for any feedback!


回答1:


I removed the complete built in Authentication (NuGet packages & classes) from my solution (since i didn't needed them) and this made the above case work as it was. I can't elaborate more on the what's and how's (i am sure other people can) but i think it has to do with routing that comes with the authentication.



来源:https://stackoverflow.com/questions/54587860/mvc-c-sharp-activation-url-redirects-to-other-path

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