asp.net-mvc-routing

Adding Redundant Information to a MVC Route

廉价感情. 提交于 2019-12-12 08:08:42
问题 As you come to this question you'll notice the title of the question is in the address bar and the link you clicked on to get here. I am not sure the exact terminology so found it difficult to search for but how can I do something similar? That is, How can I add data to the address bar which is purely for show/search engines. Thanks 回答1: Taking the example of a Stack Overflow question like this one the URL is: so.com/questions/1142480/adding-redundant-information-to-a-mvc-route However, the

MVC 4 Area Routing is not working

北城余情 提交于 2019-12-12 07:47:55
问题 I created an empty MVC4 Application, all things are working fine, after that I add an Area to my Project Named "Moderator". My area routing code is like this: using System; using System.Web.Mvc; namespace EskimoArt.Areas.Moderator { public class ModeratorAreaRegistration : AreaRegistration { public override string AreaName { get { return "Moderator"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Moderator_default", "Moderator/{controller}/{action}

Using IIS Application Request Routing (ARR) for ASP.NET MVC

不羁的心 提交于 2019-12-12 07:13:49
问题 I use a simple ASP.NET MVC web (the template you use when you create a new site) and the web works as expected in my live environment. I now try to use IIS Application Request Routing version 2. I have a rule that send all requests to a different server that match a rule. The settings are a bit like this: http://blogs.iis.net/wonyoo/archive/2008/07/09/application-request-routing-arr-as-a-reverse-proxy.aspx My rule is just a bit different it is /shop(.*). Only requests that contain shop are

How to register routes that have been defined outside Global.asax

半城伤御伤魂 提交于 2019-12-12 05:31:55
问题 I'm trying to implement the pattern that's introduced by this question The accepted answer provides a strategy where routes have been defined in a separate class. The question I have is exactly how to call that code from Global.asax. thx 回答1: See another answer from the same question, or more specifically the link provided in that answer. All that you should have to do is add an instance of ExampleRoute to the RouteCollection in the global.asax. public static void RegisterRoutes

Angular Routing with ASP MVC

北战南征 提交于 2019-12-12 05:23:35
问题 I have an MVC test project I am working on to see if I can get angular routing to work with it. What I mean by work with it is that I want to be able to have a landing page for my app: www.testapp.com Then when people log in I want MVC to route them to testapp.com/Dashboard/#/ and then I want to be able to use ng-view to load pages with Angualar like so: testapp.com/Dashboard/#/PageOne , testapp.com/Dashboard/#/PageTwo , etc. Here is what I have tried: main.js: angular.module('App', ['ngRoute

.NET MVC - Controller/View and physical path?

别来无恙 提交于 2019-12-12 04:37:58
问题 Is it possible to have controller/view for URL: http://mydomain/SomeFolder/ And a similar physical folder to put files in it http://mydomain/SomeFolder/*.* Currently URL http://mydomain/SomeFolder/ , only returns the physical folder is browsed if web.config allows it, but I would like it to return the view and http://mydomain/SomeFolder/*.* to return the files contained in the folder. 回答1: Yes, this is possible. Let's suppose that you have the ~/SomeFolder/foo.png file and a ~/Controllers

Correct me on URL routing in MVC issue

帅比萌擦擦* 提交于 2019-12-12 03:26:11
问题 This is related my question which i asked in this link correct me on url routing in mvc Now i came with another problem, so i thought i will ask it as new question. Now i have following routes in my global.asax file routes.MapRoute( "Custom", // Route name "{action}/{id}", // URL with parameters new { controller = "Authentication", action = "BigClientLogin", id = UrlParameter.Optional } // Parameter defaults ); and routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL

mvc url.action returning null or url as get

白昼怎懂夜的黑 提交于 2019-12-12 03:07:39
问题 I am using mvc Url.Action as this <a href="@Url.Action("Index", "Product", new { area = "Product", search = UrlParameter.Optional, categoryId = category.IdCategory })"> I have my routing as:- public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Product_default", "Product/{controller}/{action}/{id}/{categoryId}", defaults: new { controller = "Product", action = "Index", search = UrlParameter.Optional, categoryId = @"\d+" }, namespaces: new[] { "IBuyFrontEnd

Nothing happened with custom IRouter in Asp.Net Core

若如初见. 提交于 2019-12-12 03:06:31
问题 I have the following implementation of my router: public class TenantUrlResolverRouter : IRouter { private readonly IRouter _defaultRouter; public TenantUrlResolverRouter(IRouter defaultRouter) { _defaultRouter = defaultRouter; } public VirtualPathData GetVirtualPath(VirtualPathContext context) { return _defaultRouter.GetVirtualPath(context); } public async Task RouteAsync(RouteContext context) { var oldRouteData = context.RouteData; var newRouteData = new RouteData(oldRouteData);

Why is my Web API routing being re-routed / falsely routed?

陌路散爱 提交于 2019-12-12 02:55:51
问题 I have two GET methods for a particular Controller / Repository: public IEnumerable<InventoryItem> GetAllInventoryItems() { return inventoryItemsRepository.GetAll(); } [Route("api/{controller}/{ID}/{CountToFetch}")] public IEnumerable<InventoryItem> GetBatchOfInventoryItemsByStartingID(string ID, int CountToFetch) { return inventoryItemsRepository.Get(ID, CountToFetch); } Even though I've tried calling it all these ways from the client, with two arguments: 0) formatargready_uri = string