routing difficulty

Posted by user281180 on Stack Overflow See other posts from Stack Overflow or by user281180
Published on 2010-05-27T10:54:50Z Indexed on 2010/05/27 11:41 UTC
Read the original article Hit count: 241

Part of my application maps resources stored in a number of locations onto web URLs like this:

http://servername/Issue.aspx/Details?issueID=1504/productId=2345

Is it possible to construct an MVC route that matches this so that I get the path in its entirety passed into my controller? Either as a single string or possibly as an params style array of strings.

In my Global.aspx I have routes.MapRoute( "Issue", "Issue/{Details}", new { controller = "Issue", action = "Details" }, new { issueId = @"\d+", productId = @"\d+" } );

I have tried the code

 RouteValueDictionary parameters = new RouteValueDictionary { {"Controller", "Issue"},{ "action", "Details" }, { "issueId", Test.ID }, {"productId", Test.Project.ID} };
        VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, parameters);
        var test =  vpd.VirtualPath;

test value is

/Issue.aspx/Details?issueId=1504&productId=3625.

How to generate URLs Using ASP.NET Routing and sends it to users and they should be able to open the page by clicking on the generated link. However, here the servername isn`t included. How can I have the servername with the the link as http://servername/Issue.aspx/Details?issueID=1504/productId=2345

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc