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

ASP .Net Core + Angular 2 routing

I have a controller that returns partial views, which then are used as an Angular 2 templateUrl. For Example: Angular component: @Component({ selector: 'my-app', templateUrl:'/partials/index', Controller: public class PartialsController :…
t_tsekov
  • 177
  • 3
  • 11
0
votes
1 answer

C# Web API 405 method not routing to my PUT, always hitting my GET

I have been working with Web API for well over a year, and haven't run into this problem before. I am really at my witt's end after spending hours googling, and looking at stack overflow posts etc. I am wondering if I just have some brain fart…
Danny
  • 308
  • 1
  • 4
  • 12
0
votes
1 answer

MVC RouteConfig custom maproute issue

I have this in my routeConfig: routes.MapRouteLowercase( name: "newProduct", url: "{name}-{thisID}", defaults: new { controller =…
Sepehr Estaki
  • 331
  • 5
  • 19
0
votes
1 answer

Bidirectional Route in ASP.NET Routing

Okay, here's the deal: I have an aspx page that looks like mysite.com/UnitDetails.aspx?UnitID=123 Right now I've setup my routing to be able to take in something like mysite.com/My/Path/123 and redirect it to UnitDetails.aspx. This works…
Austin
  • 387
  • 6
  • 11
0
votes
0 answers

Get VirtualPath of a Route

I have the following Route: routes.MapPageRoute("RouteTest", "Path1/Path2/Path3/{PARAM1}-{PARAM2}/{OPTPARAM}", "~/MyPath/Default.aspx", True, New RouteValueDictionary(New With {.OPTPARAM = Nothing}), …
igorjrr
  • 790
  • 1
  • 11
  • 22
0
votes
1 answer

How to prevent controllers in wrong areas from being used in MVC5

My MVC application is set up with controllers at the root/global level. These have no explicit Area. I also have a single "Admin" area. URLs that begin with /admin/ are routed to the matching controller in the Admin area. Other URLs are routed to…
Sam
  • 4,994
  • 4
  • 30
  • 37
0
votes
2 answers

Advanced ASP.NET MVC routing scenario

I have an ASP.NET MVC app with the following deployment requirements: The URL structure must be something like: http://server/app/[enterprise]/[communinty]/{controller}/{action}/... What I think I want to be able to do is intercept the URL before…
jlew
  • 10,491
  • 1
  • 35
  • 58
0
votes
1 answer

Asp.net MVC 4 Catch All Routing

I've been learning and doing examples with angular and Asp.Net MVC. I ran into an issue with a catch all route. After adding the catch all route, my browser kept crashing. If I remove the catch all, the url works fine except refreshing the page is…
Jean B
  • 343
  • 1
  • 6
  • 19
0
votes
1 answer

asp.net routing (in webforms) without wildcard mapping

If you cannot turn on wildcard mapping for IIS (shared hosting) or can't be bothered (lazyness) can you still use ASP.Net routing if your routes end in one of the "known" asp.net extensions...like ending all routes with .ashx, .aspx etc? From Chris…
davidsleeps
  • 9,393
  • 11
  • 59
  • 73
0
votes
1 answer

ASP MVC ReidrectToRoute without query string

I use this code in Controller to RedirectToRoute return RedirectToRoute(new { controller = "Posts", action = "Post", parametr1 = "11", parametr2 = "aaaaaaaa" …
user3748973
  • 449
  • 2
  • 8
  • 24
0
votes
2 answers

HttpPut Request in C#

I'm fairly new to this Web API stuff and I'm trying to set up simple http requests to a local database on my computer. I have a get request that looks like this: [HttpGet] [Route("")] [Route("{ID:int}")] public IQueryable Get(int id =…
Wes Thompson
  • 462
  • 1
  • 5
  • 21
0
votes
1 answer

Generating a Webpage When It doesn't Exist

How can I generate a webpage based on users request? for example, If someone wants to visit "www.mywebsite.com/example" and there is no such url, My website will generate him/her a webpage based on word "example". How can I do it? (I'm developing my…
Amir
  • 11
  • 2
0
votes
1 answer

How to get routevalues from URL with htmlhelpers or JavaScript?

I have this MVC MapRoute routes.MapRoute( name: "Authenticated", url: "{controller}/{action}/{foo}/{bar}", defaults: new { controller = "Home", action = "WelcomePage", Foo = "0", Bar = "0" } ); And…
radbyx
  • 9,352
  • 21
  • 84
  • 127
0
votes
2 answers

Using Routing to return a WebForms page

If I have a simple Default.aspx WebForms page under Views/WebForms/Default.aspx, how do I configure the MVC routing to open the Default.aspx page at startup? I've tried reading some articles regarding the MVC 6 routing, but I don't think they're…
nic
  • 2,125
  • 1
  • 18
  • 33
0
votes
1 answer

Posting objects containing other models

I've been searching for a way to post all the information of a model which contains other models and I believe I can just send the object to my view and go off of the 50 examples I've looked at and can render everything just fine. Here's my model…
Luminous
  • 1,771
  • 2
  • 24
  • 43