.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Url Routing in ASP.NET

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :ASP.Net
hi friends i have a web project and that have over 150 pages now if i used URL Routing in this project speed and performance less or no?        

View Complete Post

More Related Resource Links

Routing for Web Forms in ASP.NET 4.0

posted a prototype demonstrating how one could use Routing within Web Forms. This is something you can do today with ASP.NET 3.5 SP1, because of the work we did to separate Routing from ASP.NET MVC. I would have liked to include Web Form Routing as part of the Routing feature when we were working on SP1, but we didn't have the time to do so in a robust manner before SP1 was locked down.

What's new in ASP.NET 4.0 - Part II - Routing in Webforms

This post covers one such feature which is Routing in Webforms. Although Routing was available even in .NET 3.5 SP1, (check this excellent post by Phil Haack on implementing Routing in ASP.NET 3.5 with .NET 3.5 SP1), it was kind of less known. Also the plumbing work was too much for getting it implemented.

ASP.NET 4.0: WebForm Routing (quick n dirty version)

One of the things we're adding in ASP.NET 4.0 is built-in support for using Routing together with WebForms. Now, I'm totally aware that this is possible to do already and that a number of people have posted ways of doing this with the Web Routing feature which shipped with ASP.NET 3.5 SP1. We're just adding some features to make it easier to do

Problem upgrading to MVC3 - System.Web.Routing



I'm trying to upgrade to .NET 4 and MVC 3.

When trying to compile my project, I get the error:

Error 1 The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) C:\Users\spencer\Desktop\weblauncher\Common\MVCConfig.cs 4 18 Common

The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

I do have the System.Web.Routing in my references for the project.

BUT - when I try to view System.Web.Routing in the OBJECT BROWSER, nothing is inside!  The System.Web.Routing namespace is not in there - the entire thing is empty!  Could it that the dll is corrupted?  I tried to reinstall the .NET 4 and MVC 3 stuff, but its still empty!

The dll is coming from here:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Routing.dll

and the runti

Routing in dynamic data applications


Im using ASP.Net 4. I tried to modified the code according to following video tutorial. http://www.asp.net/aspnet-in-net-35-sp1/videos/how-to-enable-table-specific-routing-in-dynamic-data-applications

But Product page directs only to ListDetails.aspx page.

This is my code :

<%@ Application Language="C#" %>
<%@ Import Namespace="System.ComponentModel.DataAnnotations" %>
<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="System.Web.DynamicData" %>

<script RunAt="server">
    private static MetaModel s_defaultModel = new MetaModel();
    public static MetaModel DefaultModel {
        get {
            return s_defaultModel;

    public static void RegisterRoutes(RouteCollection routes) {

        DefaultModel.RegisterContext(typeof(NorthwindDataContext), new ContextConfiguration() { ScaffoldAllTables = true });


URL Routing and Existing HttpHandler problems


Hello everyone,

I have a problem:

I am currently using 2 features: 

1. HttpHandler

Registering the path="res.aspx" verb="*"

2. URL Routing:

Registering with this pattern: "Company/Edit/{*companyId}","~/CompanyEdit.aspx"

In my CompanyEdit.aspx page, I used httphandler res.aspx to generate some images at client.

  • res.aspx?img=1
  • res.aspx?img=3

Now the problem is here, the page is load success with companyId = "12345", but when the images was loaded at client, it loaded the CompanyEdit.aspx again and show error with wrong id.  

I have debug and find the problem that because when image's urls were generated to client with url=res.aspx?img=1, url=res.aspx?img=3, the asp.net will understand that they are Company/Edit/res.aspx?img=1, Company/Edit/res.aspx?img=3 when it maps with URL Routing pattern.

=> So the CompanyEdit.aspx was load again with wrong id (id now is "res.aspx"). 

So, do you have any ideas to solve this problem, or other design.

Thanks, and best regard

Extreme ASP.NET: Routing with ASP.NET Web Forms


See how to get the benefits of rerouting while alleviating the risks with this in-depth look at URL rewriting in ASP.NET.

Scott Allen

MSDN Magazine January 2009

routing fails



I am trying to compile and run an asp.net application and am getting the following errors

 HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

I have a starting URL of http://localhost:61431/WebSuds/Suds/Welcome and routing code

"Default",                                 // Route name
"{controller}/{action}/{page}",            // URL with parameters
new { controller = "Suds", action = "Welcome",

Strange URL Routing Problem, participially working


I am setting up URL Routing on my existing project. I am not using mvc.

The routing only working like this: http://www.example.com/sdevil.m

not working with single word like this: http://www.example.com/sdevil

I am getting error message:The resource cannot be found.

Looks like when I using single word, application think that is folder?

How can i fix this? Thank you for any helps.

Video: SharePoint 2010: Advanced Routing and Document Sets

Learn how to work with document sets such as RPFs (Request for Proposal), which may be made up of multiple documents such as the question document, the answer document, and many other supporting documents and files. (Length: 13:56)

Problem with default routing

Hi, I am Ashish. I have developed an ASP.NET web application using MVC 1.0. I have taken a view named TaskUI and Controller TMController. I have chosen my UI page is as default page, and accordingly I changed Default Rout as given bellow: routes.MapRoute( "TaskUI",// Route name "{controller}/{action}/{id}"// URL with parameters new{ controller = "TM", action = "CreateTask", id = "" } // Parameter defaults); It is working great... My UI page contains a textbox which is tagged with a javascript onChange function <%=Html.TextBox("TaskId", ViewData.Model.Task.TaskId, new { size = 10, onChange = "GetTaskInfo1()", onkeypress = "InputOnlyNumber(event)" })%> When I input a value on the textbox and press the tab the javascript function is called which isfunction GetTaskInfo1() { var vCalleeVar1 = document.getElementById('TaskId').value; if (vCalleeVar1 != undefined && vCalleeVar1 != null) { location.reload("GetTaskInfo?pTaskId=" + vCalleeVar1); return true; } else return false; } Now the problem is the URL that gets LocalHost.../GetTaskInfo?pTaskId=123, whether it should be LocalHost.../TM/GetTaskInfo?pTaskId=123, because the action "GetTaskI

Routing pox, json & soap

I have a service exposed as pox, json & soap, as described at http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html. It exposes the endpoints: - http://localhost:81/TestService/soap - http://localhost:81/TestService/pox - http://localhost:81/TestService/json I now want to have a router, and to verify functionality, just expose it at http://localhost:82/... and have it forward calls to http://localhost:81/... I get this to work fine with the pox endpoint by following the initial steps at http://msdn.microsoft.com/en-us/magazine/cc500646.aspx, but I can't get it to work with soap or json. How should this be set up to have one router handle calls to all three enpoints? Hälsningar Anders

WCF Routing Service BindingConfiguration does not applied

Hi i am having issues working with the routing service All works fine Until one of the functions of the web service returned big amounts of data from the server, The status: I am having: 1. Silverlight application (client) 2. UI server (Contains the routing service) 3. Application Server (Contains the WCF Service which getting data from the database) The silverlight application is currently hosted both on the UI server and Application server. The services of the application server configured with the following: <basicHttpBinding> <binding name="BigServicesBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" receiveTimeout="00:02:00" > <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647" maxDepth="2147483647" </binding> </basicHttpBinding> I have also set the routing service bindingConfiguration to this binding configuration. When running the silverlight application against the Application server - it works well When running the silverlight application against the UI Server when returnning big amount of data i am getting exception: System.ServiceModel.CommunicationException: The remote server returned an

MVC Routing and WebForm Routing in same Project

We have developed Web Application with WebForm in ASP.Net 3.5 and C#.  Later we migrated this Application to ASP.Net 4.0. We have already used Routing Feature for WebForm Application. The extension to this application also needs to run on different SMART Phones. To support that we have developed Application in the MVC. Means, we have single Web Application with WEBForm + MVC and both will run side by side.   Now, we are facing issue that How to configure Routing (as, we need Routing to be used WebForm as well as MVC).   How to manage this?   Thanks      

Help! URL Routing in SharePoint 2007 ASP .NET 3.5?

Hi, After spending lot's of time crawling the web for a straight forward solution for using URL Routing in SharePoint 2007 (and also 2010) with ASP .NET 3.5 I have realized that URL Routing is better suited for MVC applications and has been a lot simplified as well in .NET 4.0, which doesn't really help me much ;) Does anyone have any information or experience to share regarding this? Any recommendations for a blog post or similar, of how to implement a solution in SharePoint 2007 or preferably in 2010 using .net 3.5 non-MVC? I found one single solution though, but not with too much information: http://stackoverflow.com/questions/122175/using-asp-net-3-5-sp1-routing-with-sharepoint-2007 Using the guide above, as soon as I add the Http module: <add name="Routing" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> ..to my web.config I get the "System.ArgumentException: virtualPath" (I might add, I am not a SharePoint expert just yet ;). So please help me, I would be greatful for any information at all!! Kind Regards/Jesper Wilfing [ArgumentException: virtualPath] Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.IsExcludedPath(String virtualPath) +486 Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.FileExists(String virtual

Routing, Paging and Area problem. Please, anyone?

Hello,On a pager I use on my MVC site I create the page links as follows: private String GetPageLink(Int32 number, String text) { RouteValueDictionary link = new RouteValueDictionary(_values); link.Add("page", number); VirtualPathData path = RouteTable.Routes.GetVirtualPath(_context.RequestContext, link); return path == null ? null : String.Format("<a href=\"{0}\">{1}</a>", path.VirtualPath, text); } // GetPageLink On a MVC 2 web site I have an area named CMS.For example, on "cms/article/list" the pager works fine.However, on my root views, for example in "article/index" the page 1 link become:  http://localhost:7422/cms/article?page=9It should be just:  http://localhost:7422/article?page=9o On my Global.Asax I have the following:  routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new String[] { "PrjMvc.Presentation.Controllers" }); routes.MapRoute("CMS_Area", "{area}/{controller}/{action}/{id}", new { area = "CMS", controller = "Home", action = "Index", id = UrlParameter.Optional });Any idea how to fix this?I have been going around with this and I can't find a

URL routing with a dynamic .sitemap file

Hi,I've implemented URL routing now I've upgraded to .NET 4 following http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx.The only problem I've encountered is with the .sitemap file. If I put, for example: <siteMapNode url="~/recipes/Starters" title="Browse Starters"> it renders correctly. However, I need to do something like this: <siteMapNode url="~/recipes/{category}" title="Browse {category}"> - i.e. dynamically giving a titleOr, I'd settle for something like this: <siteMapNode url="~/recipes/*" title="Browse Recipes"> - i.e. covering all recipe pages Has anyone found a nice solution to this?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend