88643

MVC routing does not work for non-default/root action controller on virtual directory

Question:

I am using the default "ASP.NET MVC 2 Web Application" on IIS (which I have no admin access to) and while I can navigate to

"server/ITEC"

I can't navigate to "server/ITEC/About" without the server returning an error - a 404 error.

I'm also using RouteDebugger for testing - when I use the default "server/ITEC" it matches (aka the default home/index controller action) but when I manually type in "server/ITEC/About" I don't even see the RouteDebugger page. Also, of note, when I place an "index.html" file in "server/Itec/About" it returns the results, which leads me to believe that the directory is configured to use the file system and not MVC routing when handling requests - is this a safe assumption?

How do I update my Global.asax file so that I can return the non-default controllers/actions? Or is this a server issue and how do I go about fixing that?

Thanks!

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace mikeProg { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } } }

Answer1:

I figured this out!

On the Wildcard application maps section for aspnet_isapi.dll the checkbox for

"Verify that file exists" was checked.

Once I asked the System Administrator to uncheck it everything routed perfectly.

Why is this even an option??? when would I use it?

Recommend

  • How to redirect to home page after session timeout
  • Web API Basic Auth inside an MVC app with Identity Auth
  • IsAuthenticated is false! weird behaviour + review question
  • Thread Synchronization with IntentService
  • const char **a = {“string1”,“string2”} and pointer arithametic
  • Gradle - How to detect --debug flag from command line?
  • Handling exceptions in a class library enveloping a device driver
  • Is MVC2 ASP.Net URLDecoding automatically?
  • Generating random numbers directly inside a .htaccess file
  • Hibernate: Inheritance and relationship mapping + generics
  • Does the Azure table storage API cache results?
  • back button function for phonegap windows phone 7
  • Losing my session variables
  • File extension of zlib zipped html page?
  • How to access meteor package name inside package?
  • vectorized indexing/slicing in numpy/scipy?
  • Updating Dojo provide
  • Defined variables not working in javascript files when I use getScript
  • How can I display the parent menu item's description using Wordpress walkers?
  • Remove changes from one element when event occurs on another element?
  • Scala multiline string placeholder
  • Is playing sound in Javascript performance heavy?
  • xtable package: Skipping some rows in the output
  • Control modification in presentation layer
  • Insert into database using onclick function
  • QLineEdit password safety
  • What is Eclipse's Declaration View used for?
  • Azure Cloud Service Web Role web pages do not load
  • Fill an image in a square container while keeping aspect ratio
  • Knitr HTML Loop - Some HTML output, some R output
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • How to make Safari send if-modified-since header?
  • Web-crawler for facebook in python
  • Rearranging Cells in UITableView Bug & Saving Changes
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Understanding cpu registers
  • Add sale price programmatically to product variations
  • Reading document lines to the user (python)