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
0
votes
0 answers

MVC Area routing in a folder

I have an MVC area app and it works fine locally: https://localhost:8080/Area/Controller/View But when I push to the server the routes get screwed up because the application is in a subfolder of the default web site like…
cdub
  • 24,555
  • 57
  • 174
  • 303
0
votes
3 answers

ASP.NET MVC 2 Routing Errors

After publishing an ASP.NET MVC 2 web application to my schools IIS 7.5 server, I receive a 403 error on initial load and then a 404 error if I try and invoke a route such as /Home/About/Index I have even tried publishing the default ASP.NET MVC 2…
whall
  • 21
  • 4
0
votes
0 answers

RouteData values are valid on one page but empty on another

I have an app I'm building for automating the process of creating media kits when promoting a show or local event and I've hit something weird. In my application, I have two web forms ~/KitInfo.aspx and ~/Photo.aspx. In my ~\App_Start\RouteConfig.cs…
amber
  • 1,067
  • 3
  • 22
  • 42
0
votes
1 answer

MapPageRoute - can't send empty strings in the middle?

In Global.asax.cs in a project that I'm maintaining there is a method that looks like this private static void MapRouteWithName(string name, string url, string physicalPath, bool? checkPhysicalUrlAccess = null, RouteValueDictionary defaults =…
0
votes
0 answers

Routing with MVC and Webforms

I am experiencing a routing issue with a webforms site to which I recently added MVC. Webforms is the default part of the site. Here is my RouteConfig.cs code: public static void RegisterRoutes(RouteCollection routes) { …
CTBrewski
  • 313
  • 4
  • 7
0
votes
0 answers

Redirecting action from one controller to other with different secure attributes, ASP.NETCore 2.0

I have one question, which connected with redirecting and auth policies. Let's have one controller, which allow Anonymous method like this: [Route("Authorization")] [Authorize] public class AuthorizationController : Controller { ... …
Dmitriy
  • 847
  • 17
  • 39
0
votes
0 answers

ASP.NET Core 2.0 routing - how to have a correct absolute route?

Here's the routing config for ASP.NET Core 2.0 app: routes.MapRoute( "auth", "session/{action}", new { controller = "Session" } ); routes.MapRoute( …
AlexB
  • 4,167
  • 4
  • 45
  • 117
0
votes
2 answers

Route Url in ASP MVC with changing parameters name

I'm using Asp.NET mvc 5 I have the following controller public class AController : Controller { public ActionResult ActionA(int param1, int param2) { return Content("Whatever") ; } } What is the correct way to redirect url…
Pablo Honey
  • 1,074
  • 1
  • 10
  • 23
0
votes
1 answer

Routing migration from ASP.NET WebAPI to ASP.NET Core WebAPI, ambiguous method issue

I have existing ASP.NET WebAPI which I want to migrate to ASP.NET Core WebAPI, but facing some issues in routing. The APIs are already consumed by many clients and I cannot change the routes (or URLs). We have a controller (say ValuesController)…
0
votes
2 answers

Remove "Home/Index" secondary route to home page

I have an ASP.net MVC 5 site. The home page is at http://mydomain. However, there's also a second route to the home page - http://mydomain/home/index - which I think This causes problems because it may be seen as duplicate content, and images are…
niico
  • 11,206
  • 23
  • 78
  • 161
0
votes
1 answer

Returning to login action after logging in with correct credentials

My MVC application seems to be acting a little bit weird in production environment, though working fine on local machine. Here's my scenario: User enters my site User is not logged in, therefore redirected to login page User enters credentials User…
Detilium
  • 2,868
  • 9
  • 30
  • 65
0
votes
0 answers

ASP MVC5 OnActionExecuting RedirectToRouteResult causes infinite loop

I have a filter attribute that checks for a route parameter and if it doesn't exits I apply some logic to check if the current request needs to be redirected to another route. My code looks like this Public Overrides Sub…
rojobo
  • 476
  • 4
  • 16
0
votes
1 answer

How to call endpoint using routing table in wcf?

I have created 1 demo web application in which i am trying to consume wcf service which contains no svc file.Basically i am trying to add routes to routetable like we add in asp.net mvc. I have taken reference from here :Reference Code : …
I Love Stackoverflow
  • 6,738
  • 20
  • 97
  • 216
0
votes
0 answers

How to add routes to routing table while application is running?

I am having 1 interface from where user can create end points like below : /Customer/{Customer}/Address /Customer/{Customer}/Address/{Address} As i understand that routing is added to routing table at the start of application i.e when…
I Love Stackoverflow
  • 6,738
  • 20
  • 97
  • 216
0
votes
4 answers

Asp.Net routing which redirects to homepage if url parameter is not defined

I have two routes routes.MapRoute( name: "Default", url: "{location}/{controller}/{action}/{id}", defaults: new { controller = "Products", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( name: "Home", url:…
Mantas Čekanauskas
  • 2,218
  • 6
  • 23
  • 43