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

Editing already defined routes

I'm working on a dynamic project which is adding or changing the route urls. For example: I want to add sub application route like AppName/{controller}/{action}/{id} or maybe a language information like {controller}/{action}/{id}/{language} in this…
user2228413
0
votes
0 answers

Serve files dynamically instead of statically

Following this answer, I've enabled serving JavaScript and CSS from my Views folder which is helping my project's organization. Unfortunately, while I'm developing, I find I have to disable my browser cache in order to see my changes. I'd like to be…
ricksmt
  • 888
  • 2
  • 13
  • 34
0
votes
2 answers

C# MVC 5 Html.ActionLInk

I'm working through a C# MVC 5 application on Udemy, and I have gotten stuck on calling a method from the view, using Html.ActionLink. I've tried passing the customer object,then settled on trying to pass the id. For a reason that I don't…
0
votes
1 answer

action name with hyphens in asp.net mvc

I want to be able to call a page the in following way: www.mydomain.com/articles/article-name-with-hyphens I tries the following: public class ArticlesController : Controller { [ActionName("article-name-with-hyphens")] public ActionResult…
dsb
  • 2,347
  • 5
  • 26
  • 43
0
votes
1 answer

Visual Studio 2010 ASP.NET 4.0 WebForms Routing Not Working in IDE Debug Mode

Greetings, I am using Visual Studio 2010 and ASP.NET 4.0 to build a WebForms project that uses the new routing features in System.Web.Routing. When I build my solution and run it from within VS.NET's debugging environment only routes with…
MomentSurfer
  • 128
  • 2
  • 8
0
votes
1 answer

combine two routes to one action

I'd like to define one MapRoute which can map two different routes to one action. I have an action to create an address: public class AddressesController : BaseController { public ActionResult Create() { ... } } Following two…
0
votes
2 answers

Fix error with route url in Asp.Net MVC 5

I have this datamodel: so one Project has many Milestones. What I did is this: when I go to the detail of a specific Project, I can add/create Milestones for it, like in the picture: When I click "Create Milestone" I navigate to the View where I…
Arianit
  • 543
  • 2
  • 8
  • 24
0
votes
2 answers

asp.net MVC - shorten route, disable old route

I have an asp.net MVC 5 site. I have many routes - eg http://example.com/places/placename http://example.com/home/about http://example.com/home/privacy The first is dynamic - the latter two just point to the about & privacy actions in the home…
niico
  • 11,206
  • 23
  • 78
  • 161
0
votes
1 answer

Return url by routename and routevalues

I'm trying to programatically generate a link by routename and routevalues. I store the routes and values in the database. How can I adjust this helper in order to make it work? public static string GenerateLink(this HtmlHelper helper, string…
Lasse Edsvik
  • 9,070
  • 16
  • 73
  • 109
0
votes
1 answer

No HTTP resource was found that matches the request URI, No type was found that matches the controller

When i am hitting the url: http://localhost/api/adxxx/getDeals/?input=2 I get the following error: "Message": "No HTTP resource was found that matches the request URI 'http://localhost/api/adxxx/getDeals/?input=2'.", "MessageDetail": "No type was…
0
votes
2 answers

Why isn't this capturing the [HttpGet] and [HttpPost] attributes?

I have a piece of code like foreach(var controller in controllers) { // ... var actions = controller.GetMethods() .Where(method => method.ReturnType == typeof(IHttpActionResult)); foreach(var action in actions) …
Ms. Corlib
  • 4,993
  • 4
  • 12
  • 19
0
votes
1 answer

Redirect a list of URLs to the homepage in ASP.NET 4 MVC web app

I have a lot of URLs I need to redirect to the homepage (the reasons are convoluted - and SEO isn't important so be assured this is what I need to do). eg mydomain.com/hello mydomain.com/bye mydomain.com/whatever & 30 more all need to be…
niico
  • 11,206
  • 23
  • 78
  • 161
0
votes
0 answers

How to redirect to another route with When i submit a form in asp.net mvc

I have attribute for filter route. when I submit a form I want redirect to another controller with a filter attribute. My filter attribute name is spam attribute. Now I have a code for change route public override void…
Amin Saadati 2
  • 95
  • 1
  • 10
0
votes
1 answer

After throwing a Security Exception, redirect to Login page

I'm using WebForms and Asp.Net Routing. When trying to implement security on a members folder, I'm following the directions here : http://blogs.msdn.com/b/mikeormond/archive/2008/06/21/asp-net-routing-and-authorization.aspx private IHttpHandler…
0
votes
1 answer

Multiple actions were found that match the request error when adding a second GET action method to web api controller

I'm currently developing a Web API and I'm figuring out about how to add a new method inside my controller FilmsController which has to execute a LINQ query simply returning the related JSON to the user. Everything seems correct but when I try to…