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
2
votes
1 answer

WebApi HttpDelete woes

I have a controller like this (I will post all the code just so you can see how it is all working). /// /// Handles all of the Upload functions, including GetAll, Get and Create. /// [RoutePrefix("Api/Uploads")] public class…
r3plica
  • 13,017
  • 23
  • 128
  • 290
2
votes
1 answer

How to use ASP.NET Routing in a Quote of the Day Website

Good Afternoon, A client is interested in creating an ASP.NET 2.0 website whose purpose is to serve up a "quote of the day". He wants the quotes on static content pages all attached to the same master page. The quote pages must be viewed in a…
SidC
  • 3,175
  • 14
  • 70
  • 132
2
votes
2 answers

ASP.NET MVC not using controller for explicit file route in IIS7

Consider a StaticResourceController that locates and serves files. I've set up an explicit route for "favicon.ico" that will handle the request for this file using StaticResourceController: routes.MapRoute( "favicon", "favicon.ico", …
Daniel Crenna
  • 3,326
  • 1
  • 24
  • 34
2
votes
1 answer

ASP.NET WebForms URLRouting - All Routes Receiving 404

All routes within my ASP.NET URL Routing web application are receiving a 404. However, the actual pages that exist are showing up correctly. I'm using IIS7. Any ideas?
2
votes
1 answer

ASP.NET Web API custom message handler per route and global

I have 3 ASP.NET Web API message handlers: Handler1 Handler2 AuthorizeHandler Handler1 and Handler2 are global (applying to all routes) and one single handler (AuthorizeHandler) applies to one single route. However I have some issues in…
2
votes
1 answer

Can custom IHttpHandler revert to default request handling?

I'm writing a custom HttpHandler to process web requests for a web framework I'm writing but trying to find a way to programatically "ignore" the request if no url route is matched. What I mean by ignore is if no predefined route matches the…
David
  • 1,731
  • 24
  • 37
2
votes
2 answers

Empty query string parameters with ASP.NET MVC

Is it possible to add "empty" query string parameters with ASP.NET MVC? I need to somehow generate the following url using Html.ActionLink: /Home/Index?foo However this Html.ActionLink("Index", "Index", new {foo = ""}) will output /Home/Index Is…
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
2
votes
1 answer

How to pass the value when I am clicking the Star in Rating control?

When i am rating the star to 5 the id value should be passed as 10. It is passing the value as 1. If i rate the star to 4, the same value(1) is passing to the Controller. This is repeating for all the rated values, I have delete all my previous code…
Vetri
  • 347
  • 2
  • 6
  • 23
2
votes
1 answer

ASP.NET Routing (3.5) - How to handle multiple TLD domains?

Is it possible to have one asp.net web application that handles requests from two domains via asp.net routing? I need one TLD domain per language version pointing to the same app. How to set up a route that recognize, if the request is coming from…
Cosmo
  • 21
  • 1
2
votes
0 answers

System.Web.Http.HttpRouteCollection: What is the equivalent of RouteCollection.IgnoreRoute?

I'm trying to change a webapi project to use OWIN, based in part on this article: http://www.asp.net/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api However this appears to involve changing my RouteConfig.RegisterRoutes method…
mutex
  • 7,536
  • 8
  • 45
  • 66
2
votes
1 answer

Web api controller with two get methods having same paramteres

I am building a Http service using asp.net web api, I have two get methods in the controller with the same parameters, I can't figure out how to define the route the matches both methods, I can call only one of them and for the other I get an error…
Yasmine
  • 1,959
  • 5
  • 21
  • 37
2
votes
1 answer

MVC ignores route prefix

One of our MVC sites has some odd URLs showing up in google analytics: www.domain.com/(F([long 232 character hex string here]))/Route/etc There's a very long string inserted before the main route which the MVC routing ignores. What is this? I know…
2
votes
1 answer

Asp.net Routing not works when hosted on root

I have used Asp.net 4.0 Routing techniques to achieve friendly urls. I have used following code in global.asax.. void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } void RegisterRoutes(RouteCollection…
angfreak
  • 993
  • 2
  • 11
  • 27
2
votes
3 answers

ASP.NET MVC Hierarchy Url Routing

I have a problem My route have an extra paramater after hierarchical category. /2009/World/Asia/08/12/bla-bla-bla asp.net mvc does not support this because my routing should be {year}/{*category}/{month}/{day}/{name} i tried use constraint…
Huseyin
  • 21
  • 1
2
votes
1 answer

Why is the ASP.NET routing engine ignoring files?

I have a class that implements both IHttpHandler and IRouteHandler: public class CustomHandler : IHttpHandler,IRouteHandler { public bool IsReusable { get { return false; } } public void ProcessRequest(HttpContext…
Péter
  • 2,161
  • 3
  • 21
  • 30