3

Every time I run a certain application it is showing a Not Found erroralt text

Does anyone know how to resolve this?

I placed a debugger on the page_load event in the default.aspx.cs file but it is not getting called.

Below is the routing configuration:

 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // parameters
            new { controller = "Home", action = "Index", id = "" }  // Parametedefaults
        );

I tried everything I can think of, but it is not working.

2
  • Please post your routing configuration and the error (We can't see it..) Commented Dec 24, 2010 at 11:51
  • Could it be that you don't have any routes set up to process the base URL? Commented Dec 24, 2010 at 11:53

6 Answers 6

0

What web server are you running this on VS Dev/Cassini? IIS? See if you have a default.aspx in the root folder. You need a dummy root default.aspx for MVC to work properly with some webservers.

Sign up to request clarification or add additional context in comments.

Comments

0

If you are using IIS 6 you will need a wild card mapping to the aspnet isapi filter if you are using urls without an extension. There are other options such as using a fake extension e.g. mvc and mapping through to that. By default IIS 6 doesn't know to treat pages without extensions as asp.net

Steve Sanderson gives an excellent article about deploying to IIS 6 (http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/).

Of course if you are using IIS7 then it should just work out of the box. In that case I don't know.

1 Comment

This post gives a full list of comments about deploying onto IIS 5.1 stackoverflow.com/questions/301359/…. It is a bit faffy
0

If you have all the things in their places then it seems like either:

  • The routes are configured incorrectly. Most likely you don't have proper default values for your Controller/Action.
  • You are using older IIS versions and they're not configured properly. See this for instructions.

Comments

0

Try to check your Default.aspx code as below:

using System.Web;
using System.Web.Mvc;
using System.Web.UI;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        HttpContext.Current.RewritePath(Request.ApplicationPath, false);
        IHttpHandler httpHandler = new MvcHttpHandler();
        httpHandler.ProcessRequest(HttpContext.Current);
    }
}

and you need to configure your iis's wildcard mapping, see below: http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx

Comments

0

From the looks of it you don't have a default route set up. Try this:

Routes.MapRoute("Site (*)", "{action}", new {
    controller = "Site",
    action = "Default"
});

This basically sets up a root route which defaults the action to "Default" if nothing is passed in. This also maps to all root routes such as /Home, /Contact, /{Whatever}.

Comments

0

as per comments in question I placed debugger on page_load event in default.aspx.cs file but it is not getting called. Below is the routing configuration:

  • have you tried to set your default.aspx as StartUp Page for your project.

and same in IIS virtual directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.