Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET url problem
I used to do when the routing server. I have a problem.
No problem if
If problem: 404 - File or directory not found.
id do this :
void Application_Start(object sender, EventArgs e)
    public static void RegisterRoutes(RouteCollection routes)
         routes.Add("News", new Route("News/{ID}",new CustomRouteHandler("~/News/News.aspx")));
CustomRouteHandler.cs class :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.Routing;
using System.Web.Compilation;
public class CustomRouteHandler : IRouteHandler
    public CustomRouteHandler(string virtualPath)
        this.VirtualPath = virtualPath;
    public CustomRouteHandler()
    public string VirtualPath { get; private set; }
    public IHttpHandler GetHttpHandler(RequestContext
        var page = BuildManager.CreateInstanceFromVirtualPath
             (VirtualPath, typeof(Page)) as IHttpHandler;
        return page;
web.config :
<add assembly="System.Web.Routing, Version=,Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web.Routing, Version=,Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler,System.Web, Version=, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
link :
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/news/22" Text="News"></asp:HyperLink>

in local no problem , but server error
Even when .Html or .jsp I use
What is the problem?
Posted 19-Jan-12 7:10am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Can you confirm if MVC is installed on the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web02 | 2.8.150326.1 | Last Updated 22 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100