Jinu Joseph Daniel
Jinu Joseph Daniel

Reputation: 6291

Asp.net routing using Globals.asax not working properly on server.Working on local

I have the following Globals.asax.cs file. It works perfectly on my local system. But the following route is not working in server http://ap6am.com/te/sdfsdf-17.html

The page is routed to http://ap6am.com/te/sdfsdf-17

Can anybody find the possible issue. The route is working in my local sytem.But not on server. The contents of my Globals.asax.cs is given below.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;

namespace andhravilas
{
    public class Global1 : System.Web.HttpApplication
    {

    protected void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes(RouteTable.Routes);
    }

    public void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("GArticle", "Gallery/{slug}", "~/Gallery/Article.aspx");

        routes.MapPageRoute("GCategory", "Gallery/Categories/{slug}", "~/Gallery/Categories.aspx");

        routes.MapPageRoute("GSlideShow", "Gallery/{slug}/{id}", "~/Gallery/SlideShow.aspx");

        routes.MapPageRoute("Article", "en/{slug}", "~/english/Article.aspx");

        routes.MapPageRoute("enArticleHtml", "en/{slug}.html", "~/english/Article.aspx");

        routes.MapPageRoute("Category", "en/Categories/{slug}", "~/english/Categories.aspx");

        routes.MapPageRoute("enFeed", "en/category/english/{slug}/feed", "~/en/feed.aspx");

        routes.MapPageRoute("Tags", "en/Tags/{tag}", "~/english/Tags.aspx");

        routes.MapPageRoute("tArticleHtml", "te/{slug}.html", "~/telugu/Article.aspx");

        routes.MapPageRoute("tArticle", "te/{slug}", "~/telugu/Article.aspx");

        routes.MapPageRoute("teFeed", "te/category/telugu/{slug}/feed", "~/te/feed.aspx");

        routes.MapPageRoute("tCategoryHtml", "te/Categories/{slug}.html", "~/telugu/Categories.aspx");

        routes.MapPageRoute("tCategory", "te/Categories/{slug}", "~/telugu/Categories.aspx");

        routes.MapPageRoute("tTagsHtml", "te/Tags/{tag}.html", "~/telugu/Tags.aspx");

        routes.MapPageRoute("tTags", "te/Tags/{tag}", "~/telugu/Tags.aspx");
    }
    }
}

Upvotes: 1

Views: 64

Answers (1)

Rogerio Soares
Rogerio Soares

Reputation: 1613

IIS pipeline process the request before MVC because ".html" are normaly a static files. You can setup your webconfig with :

<modules runAllManagedModulesForAllRequests="true">

http://www.iis.net/learn/get-started/introduction-to-iis/iis-modules-overview#Precondition

Upvotes: 1

Related Questions