Rest ASP.NET WEB API中的电子邮件验证URL
如何在ASP.NET WEB API中使用给定的URL进行电子邮件更改 var电子邮件=”test@test.com" var key=“122” "http://localhost:50740/api/Users/VerifyEmail/“+电子邮件+”/“+键 当我进入web浏览器时,调试它Rest ASP.NET WEB API中的电子邮件验证URL,rest,restful-authentication,asp.net-mvc-4,asp.net-web-api,Rest,Restful Authentication,Asp.net Mvc 4,Asp.net Web Api,如何在ASP.NET WEB API中使用给定的URL进行电子邮件更改 var电子邮件=”test@test.com" var key=“122” "http://localhost:50740/api/Users/VerifyEmail/“+电子邮件+”/“+键 当我进入web浏览器时,调试它 [HttpGet] public HttpResponseMessage VerifyEmail(string email, string verificationKey) { } paramte
[HttpGet]
public HttpResponseMessage VerifyEmail(string email, string verificationKey)
{
}
paramters of action method are always null.
在Global.asax.cs中,我定义了以下路径
routes.MapHttpRoute(
name: "EmailVerification",
routeTemplate: "api/{controller}/{action}/{email}/{verificationKey}",
defaults: new { action = "VerifyEmail", email = "", verificationKey = "" }
);
基本上,我想验证电子邮件处理有两个参数电子邮件和密钥
非常感谢您的回复。我通过将自定义路由移动到定义路由的顶部找到了解决方案。我准确地使用了您的代码,它对我很有效。是否有一条更贪婪的路线覆盖了您上面映射的路线?