1

In one of our web application, i need to send domain name (ex: domainname.com) as parameter with asp.net mvc routing. So i created a route definition like below:

    routes.MapRoute(
        name: "AccountDetail",
        url: "{controller}/{action}/{htip}/{dname}",
        defaults: new {
            controller = "Account",
            action = "Index"
        },           
    );

Also i have a method defined in AccountController like below:

public ActionResult Details(string htip, string dname) { }

According to the this route config and method declared in controller, MVC generates urls like http://localhost:63740/Account/Details/N/domainname.com and this is what i expect. But if i follow this url, IIS's 404 error page welcomes me instead of any MVC related page. Because MVC doesn't handle the url, because of TLD at the end (.com).

How can i achieve to make MVC handle these urls?

bahadir arslan
  • 4,535
  • 7
  • 44
  • 82
  • did you try someting like {dname}.{ext}. So you will have two parameters instead of one – Daniel Jun 20 '14 at 08:18
  • i hadn't tried that way but just tried after your message. and the result is same as i expected. If IIS detects .{ext} at the enf of URL, handle itself. – bahadir arslan Jun 20 '14 at 08:32
  • @LostInComputer yes, you are right. i found my answer at that questions. before asking question, i searched a lot but couldn't find it. thanks. – bahadir arslan Jun 20 '14 at 10:34

0 Answers0