MVC C#激活URL重定向到其他路径 [英] MVC C# activation url redirects to other path
问题描述
我有两年或两年前使用的代码,用于创建通过电子邮件发送的激活链接,并使用代码作为参数,我尝试了多种不同的方式,使用其他语法进行编码,添加web.config设置<pages validateRequest="false" />
requestValidationMode="2.0"
,注释[AllowHtml]
,实际上是在互联网上尝试了十多个帖子,但没有一个起作用.
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.
我得到的错误是: 从客户端(?)检测到一个潜在危险的Request.Path值
The error i get is: A potentially dangerous Request.Path value was detected from the client (?)
我使用的格式是
Url.Action("action","controller", new { Id = guidValue }, Request.Url.Scheme)
我的路由是默认路由,因此应该可以使用.
My routing is the Default so this should work.
单击后,地址栏中的网址就是这样:
http://localhost:52641/Account/Login?ReturnUrl=%2FAccount%2FAccountActivation%2F%3Fid%3Dfc39f53f-6fa7-43d2-b30a-8b4e20f0f237
它应该给我:
http://localhost:52641/Account/AccountActivation?id=fc39f53f-6fa7-43d2-b30a-8b4e20f0f237
这是怎么回事? 谢谢您的反馈!
推荐答案
我删除了完整的内置身份验证(NuGet包和类) 从我的解决方案中(因为我不需要它们),这使得上面的案例照常工作.我无法详细说明内容和方式(我相信其他人也可以),但是我认为这与身份验证附带的路由有关.
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.
这篇关于MVC C#激活URL重定向到其他路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!