Note that there are some explanatory texts on larger screens.

plurals
  1. POmapRoute to a Web Form using ASP.NET 4
    primarykey
    data
    text
    <p>I have a Url like this</p> <p><a href="http://localhost:4737/Site/listing/NH/Plaistow/2831516" rel="nofollow noreferrer">http://localhost:4737/Site/listing/NH/Plaistow/2831516</a></p> <p>and I want it to reroute to</p> <p><a href="http://localhost:4737/Site/listing.aspx" rel="nofollow noreferrer">http://localhost:4737/Site/listing.aspx</a></p> <p>I was reading how to do this for Web Forms here <a href="http://www.4guysfromrolla.com/articles/012710-1.aspx" rel="nofollow noreferrer">http://www.4guysfromrolla.com/articles/012710-1.aspx</a></p> <p>Here's what my route looks like.</p> <pre><code> routes.MapRoute( "FriendlyUrl", "Site/listing/{state}/{town}/{mlsnumber}", "~/Site/listing.aspx"); </code></pre> <p>In my listing page I plan on accessing the following variables</p> <pre><code> Page.RouteData.Values["state"] Page.RouteData.Values["town"] Page.RouteData.Values["mlsnumber"] </code></pre> <p>But when I navigate to <a href="http://localhost:4737/Site/listing/NH/Plaistow/2831516" rel="nofollow noreferrer">http://localhost:4737/Site/listing/NH/Plaistow/2831516</a>, I just get a HTTP 404 error.</p> <p>I know how to get this working with MVC, but this is a fairly large application, all written with web forms, so rewriting isn't feasible.</p> <p>Any ideas on how to troubleshoot this would be helpful.</p> <p>Thanks !</p> <p>Here is the working code. Thank you to <a href="https://stackoverflow.com/users/244353/mrchief">mrchief</a> for helping me resolve this.</p> <pre><code> routes.MapPageRoute( "FriendlyUrl", "listing/{state}/{town}/{mlsnumber}", "~/listing.aspx"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload