0

how can I use given URL for email varfication in ASP.NET WEB API?

var Email="test@test.com" var key="122";

"http://localhost:50740/api/Users/VerifyEmail/" + Email + "/" + key

when i enter into web browser, debug it

[HttpGet]
public HttpResponseMessage VerifyEmail(string email, string verificationKey)
{
}
   paramters of action method are always null.

in Global.asax.cs i have defined following route

routes.MapHttpRoute(
                name: "EmailVerification",
                routeTemplate: "api/{controller}/{action}/{email}/{verificationKey}",
                defaults: new { action = "VerifyEmail", email = "", verificationKey = "" }
             );  

basically, I want verification email to be handled which has two parameters email and key.

your response will be appreciated.

aamir sajjad
  • 3,019
  • 1
  • 27
  • 26
  • 1
    I used your code exactly, and it worked fine for me. Is there a greedier route that is overriding the one you are mapping above? – egbrad Apr 25 '12 at 21:38

1 Answers1

1

I found the solution by moving the custom route to the top where routes are defined.

aamir sajjad
  • 3,019
  • 1
  • 27
  • 26