Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending Asp.Net MVC routing mechanism
    primarykey
    data
    text
    <p>I've found a limitation in the routing mechanism for ASP.Net mvc and I'm trying to find a workaround.</p> <p>I posted a related question <a href="https://stackoverflow.com/questions/942593/issue-when-trying-to-route-a-path-that-ends-with-a">here</a> about the issue I was having. </p> <p>The gist of the problem is that routes that end with a . (period) are never handled by the default routing mechanism. A "Resource Cannot Be Found" error is always thrown. For example it cannot handle these urls:</p> <pre><code>http://www.wikipediamaze.com/wiki/Washington,_D.C. http://www.wikipediamaze.com/wiki/anythingendinglikethis. </code></pre> <p>if I change it to querystring parameter like this it works fine:</p> <pre><code>http://www.wikipediamaze.com/wiki/?topic=Washington,_D.C. </code></pre> <p>I'm trying to find an extensibility point in the routing mechanism that will help me resolve this issue. I've tried other solutions like this:</p> <pre><code>//Global.asax.cs protected void Application_Error() { var url = HttpContext.Current.Request.RawUrl; if(TopicRegex.IsMatch(url)) { var fixedUrl = FixUrlPath(url); //This throws an error Response.Redirect(fixedUrl); //This also throws an error Server.Transfer(fixedUrl ); } } </code></pre> <p>I'm guessing that the Response.Redirect and Server.Transfer throw errors because in MVC you should be calling the RedirectToAction methods from the controller. Of course I <em>can't even get</em> to the controller.</p> <p>This seems to be a pretty big limitation considering the Apache server that Wikipedia uses handles this just fine. try it out <a href="http://en.wikipedia.org/wiki/Washington,_D.C." rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Washington,_D.C.</a> If anyone could please offer some help here I would appreciate it.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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