Questions tagged [asp.net-routing]

ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site in both ASP.NET MVC and ASP.NET Webforms.

ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.

You can define URL patterns that map to request-handler files, but that do not necessarily include the names of those files in the URL. In addition, you can include placeholders in a URL pattern so that variable data can be passed to the request handler without requiring a query string. This topic requires an understanding of ASP.Net Routing and its design logic.

Adding Routes to Webforms

Adding Routes to an MVC Application

399 questions
3
votes
1 answer

ASP.NET URL Routing on root in IIS 6.0

I enabled a routing on ASP.NET web application running IIS 6.0 using RouteTable.Routes.MapPageRoute("Simple", "{testvalue}", "~/Test.aspx"); in Global.aspx.cs This works fine when I use http://www.MyDomain.com/Hello, however when I use…
3
votes
1 answer

What Causes the browser URL line to get filled with Route in MVC4 asp.net

When I go to my home page http://localhost:5119/ it redirects to http://localhost:5119/Home (that is what shows in my browser url bar, I want it to not show /Home) I understand that is where my default route goes but what I can't figure out…
Peter Kellner
  • 14,748
  • 25
  • 102
  • 188
3
votes
3 answers

asp.net web api routing design (multiple routes)

I'm currently designing a REST api with ASP.NET Web API. I want to provide methods like these (http methods are irrelevant - should work for all): /api/client /api/client/CID1234 (CID1234 = Id) /api/client/CID1234/orders (orders = action) The…
lapsus
  • 2,915
  • 2
  • 32
  • 61
3
votes
1 answer

ASP.NET MVC Routing: How to make my MVC URL's have .aspx extension?

I want an MVC app to have .aspx page URLs even though there will not be any physical aspx pages and I will be using the Razor view engine. 1) Is it possible to define such a route? 2) What would that route look like if I wanted a url such as, say,…
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
3
votes
1 answer

Force case-sensitive routing in ASP.NET MVC

This question has been asked in a similar but not identical fashion (and not resolved to my satisfaction) previously on Stack Overflow and elsewhere. Coming from a linux-world, I want to use ASP.NET MVC but avoid identical but differently-cased…
Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
3
votes
2 answers

How to formulate a MapPageRoute with a hash (#) in it?

I'm using MapPageRoute to make a route to a page, which works fine. However, I would like the page to scroll to the bottom to show a certain div with id bottom. I have tried to make the following route but the hash is being encoded in the URL so the…
Bazzz
  • 26,427
  • 12
  • 52
  • 69
2
votes
1 answer

asp.net url routers conflict with ajax webservice path

I have implemented ajax autocompleteExtender and it works well until i included asp.net url router. this is ajax control
As k
  • 329
  • 1
  • 6
  • 20
2
votes
2 answers

Asp.net Routing, WebServices, and IIS7 Classic

I have a web forms app running on IIS7 Classic. It utilizes .asmx style web services for a client side heavy portion of the site. We have been tasked with layering in "friendly urls" and decided to use the new Asp.net routing. We have a rule in…
ecoffey
  • 3,423
  • 4
  • 23
  • 22
2
votes
0 answers

ASP.NET Caching Vary BY Param when we have ASP.NET Routing Values instead of Query String values

Normally we can do caching and make dependency on Request.QueryString values like <%@ OutputCache Duration="15" VaryByParam="search" %> The url for such may be like: http://localhost/default.aspx?search=name But in my application i am using…
Moons
  • 3,833
  • 4
  • 49
  • 82
2
votes
1 answer

Extension-less URLs: Url Rerwrite or Routing?

I would like to make my ASP.NET web page URLs without .aspx extensions. I can do it in two ways, use IIS7 URL Rewrite module or ASP.NET URL Routing. Which method to choose?
Tomas
  • 17,551
  • 43
  • 152
  • 257
2
votes
1 answer

Routing on IIS6 With Decimal In Route

I have a route in my MVC3 project that works perfectly fine locally when run through the debugger and through IIS7. However, our servers are IIS6 and when I move my application out I am getting a "The page cannot be found" error. My guess is it has…
shuniar
  • 2,592
  • 6
  • 31
  • 38
2
votes
2 answers

Asp.net MVC3 UrlHelper.Action() throws NullReferenceException

Problem I am currently building a helper for ASP.net MVC 3 and am running into a problem considering the UrlHelper.Action() method. Every request except for the first one (after the application start) the following code throws a…
Neothor
  • 753
  • 1
  • 5
  • 10
2
votes
2 answers

asp.net MVC routing problem

I had made a website bulkpedia.com In this i had use ASP.NET Routing mechanism in the way {type}/{query} whenever there is a query that contains a period, it shows me a 404 error e.g. http://bulkpedia.com/web/fb.com please help me solve it. Thanks…
2
votes
2 answers

ASP.NET Routing. How can i use Routing in a Generic Handler?

I tried to use ASP.Net's in the following generic handler, but i get this error at Page.RouteData Reference to a non-shared member requires an object reference What i am doing wrong? <%@ WebHandler Language="VB" Class="MainHandler" %> Imports…
OrElse
  • 9,709
  • 39
  • 140
  • 253
2
votes
1 answer

ASP.NET Core 3.1 Routing - API and MVC Route confusion

I have two controllers in my application. One is an api controller, the other one a mvc controller. My routes are like this: api: /api/account/login mvc: /account/login My controllers: [ApiController] [Route("api/[controller]")] public class…
cmxl
  • 663
  • 12
  • 24