MVC C# 激活 url 重定向到其他路径 [英] MVC C# activation url redirects to other path

查看:62
本文介绍了MVC C# 激活 url 重定向到其他路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一两年前用代码来创建通过电子邮件发送的激活链接,使用代码作为参数,我尝试了很多不同的方法,编码,使用其他语法,添加 web.config 设置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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆