views:

102

answers:

2

I have an instance of BlogEngine.net installed at the root of my hosted server. I wanted to play with ASP.Net MVC to write a small app and installed that app under a folder off the root.

I am able to see the http://example.com/testApp/ but the the routed pages like http://example.com/testApp/edit are giving 404's.

I have searched around and I'm just not clear what is needed to get the routing right. Do I need to set something in BlogEngine's web.config or do I need to be doing something in my applications settings?

The host is WinHost.com and it is IIS7

Edit/Update

So I understand that the http://example.com/testApp gets served because there is a default.aspx under that directory and that the routed pages don't get served because they don't have physical aspx's. The /edit gets routed to the edit view just fine when I launch it under Visual Studio.

I am guessing that the BlogEngine.net's global.asax is trying to map these pages to the BlogEngine world and not routing them to my testApp.

If that is the case then my question is how do I get BlogEngine to forward the requests to my testApp? I was hoping that I was missing something simple in the web.config because if I have to add stuff to BlogEngine's global.asax to do routing then won't I need to rebuild BlogEngine?

+1  A: 

Do you have a Edit.aspx file existing in your application for your testApp controller? The way the default route works is:

routes.MapRoute(
"Default",                   // Route name
"{controller}/{action}/{id}",    // URL with parameters
new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
 );

So by default, when you access Home/Index, ASP.NET MVC looks for Index.aspx

In your case, your routing consists of (I just made this up):

routes.MapRoute(
"CustomRoute",                   // Route name
"{controller}/{action}/{id}",    // URL with parameters, id is optional.
new { controller = "testApp", action = "Edit", id = "" }  // Parameter defaults
 );

Where you are trying to use Edit.aspx

Inside of your Global.asax file is where all your custom routing exists, have you touched that file at all or no? The rule of thumb that I have heard about is that you want to write all the custom routing first prior to the default.

EDIT:

I also stumbled across this, might be helpful

There are four sections in the configuration file that are relevant to routing: the system.web.httpModules section, the system.web.httpHandlers section, the system.webserver.modules section, and the system.webserver.handlers section. Be careful not to delete these sections because without these sections routing will no longer work.

Taking from here

Good luck, hope this helps.

Anthony Forloney
+1  A: 

Based on the information I found in the MVC tutorial, I have discovered why my routing wasn't working.

My request processing mode on the hosted server was configured to use the Classic .NET AppPool not Integrated mode. To get it to work in classic mode you need to either modify the route table to use file extensions or create a wild card script map.

I was able to keep BlogEngine working using integrated mode so all that I needed to resolve this issue was to change the mode.

Hope this helps someone...

Jeff Alexander