asp.net-mvc-routing

System.Web.Routing.RouteCollection and System.Web.Mvc.RouteCollectionExtensions both have same simple name of 'IgnoreRouteInternal'

为君一笑 提交于 2020-01-02 22:04:10
问题 I’ve got an ASP.NET MVC project which I haven't worked on in almost two months. Debugging in a browser works fine as long as I don’t change ANY code. The moment I modify any code whatsoever, even adding whitespace, I get this error: An exception of type 'System.NotSupportedException' occurred in EntityFramework.dll but was not handled in user code Additional information: The type 'System.Web.Routing.RouteCollection+IgnoreRouteInternal' and the type 'System.Web.Mvc.RouteCollectionExtensions

ASP.NET MVC 3 Routing Multiple parameters without query string

孤人 提交于 2020-01-02 21:00:36
问题 I have the below route setup but it is not coming out the way I am expecting. Yes I am still new to MVC. The way it is coming out is like this. http://localhost:29998/Home/States?make=Chrysler the way I want it to come out is like this http://localhost:29998/Home/Chrysler/States Then of course once you click on your state it would look like this. http://localhost:29998/Home/Chrysler/Florida I would realy love to be able to remove "home from that altogether and just leave it as http:/

ASP.NET MVC 3 Routing Multiple parameters without query string

笑着哭i 提交于 2020-01-02 21:00:35
问题 I have the below route setup but it is not coming out the way I am expecting. Yes I am still new to MVC. The way it is coming out is like this. http://localhost:29998/Home/States?make=Chrysler the way I want it to come out is like this http://localhost:29998/Home/Chrysler/States Then of course once you click on your state it would look like this. http://localhost:29998/Home/Chrysler/Florida I would realy love to be able to remove "home from that altogether and just leave it as http:/

Rounting in asp mvc areas - issue with more areas

怎甘沉沦 提交于 2020-01-02 20:09:15
问题 Routing make me crazy thees days :( I have two areas: CityPage and Job On the city page I have a list of links that navigate to Job area. This is code for action and routing for CityPage: public ActionResult Index(string city, string countryCode) { return View(); } In CityPageAreaRegistration.cs class: context.MapRoute( null, "CityPage/{countryCode}/{city}", new { area = "CityPage", controller = "Home", action = "Index", city = "" } ); URL that I get here is fine http://localhost/CityPage/UK

Registering Multiple Routes in MVC asp.net

南楼画角 提交于 2020-01-02 11:27:17
问题 I want to do make several map route in MVC that both like be same. localhost:1010/abcd/home/index localhost:1010/home/index/abcd id=abcd controller=home action=index I used bellow code but it doesn't work public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "ShoppingManagment", "{id}/{controller}/{action}", new { controller = "ShoppingManagment", action = "ShoppingManagment", id = UrlParameter.Optional }); routes

ASP.NET MVC. How to suppress showing default culture in URL?

我怕爱的太早我们不能终老 提交于 2020-01-02 07:34:22
问题 here is question. I have an localized asp.net mvc website. Localization done by next steps: 1. for each route I automatically add an {culture} url segment with default value to "ru". I want my urls to be with culture only for foreign cultures. For example: http://mysite.com/ua/contacts - ukrainian http://mysite.com/fr/contacts - francis http://mysite.com/contacts - russian I can't arrive this, because @Url.Action method always returns url with culture, even then it is a default culture. Help

Controller Action Methods with different signatures

我们两清 提交于 2020-01-02 06:41:49
问题 I am trying to get my URLs in files/id format. I am guessing I should have two Index methods in my controller, one with a parameter and one with not. But I get this error message in browser below. Anyway here is my controller methods: public ActionResult Index() { return Content("Index "); } public ActionResult Index(int id) { File file = fileRepository.GetFile(id); if (file == null) return Content("Not Found"); else return Content(file.FileID.ToString()); } Update: Done with adding a route.

Routing an hierarchical path from DB with ASP.NET MVC

為{幸葍}努か 提交于 2020-01-02 04:08:05
问题 Is it possible to route an hierarchical path to map a relation from the database as follows: Let's say I have an tuple/entity "page" with an m-t-m relation to a "page" (itself) and I want to be able to combine the slug-value of each page to find an appropriate page, like so: mydomain.com/firstpage/secondpage/thirdpage where firstpage , secondpage and thirdpage are of type "page" and the third page references to the second page etc. How would you implement this with ASP.NET MVC routing? 回答1:

ASP.NET MVC 3 routing

…衆ロ難τιáo~ 提交于 2020-01-01 19:42:14
问题 i am trying to create route. Which is /emlak/TITLE/number.aspx such as /emlak/Here_is_your_best_property/123456.aspx Global.asax: routes.MapRoute( "Product", "{controller}/{deli}/{productId}", new { controller = "emlak", action = "Index" }, new { productId = UrlParameter.Optional , deli = UrlParameter.Optional } ); My controller namespace emrex.Controllers { public class EmlakController : Controller { // // GET: /Emlak/ public ActionResult Index(String productId, String deli) { return View();

MVC3 RESTful API Routing & Http Verb Handling

妖精的绣舞 提交于 2020-01-01 08:54:13
问题 I want to build a RESTful Json Api for my MVC3 application. I need help with handling multiple Http Verbs for the manipulation of a single object instance. What I've read/studied/tried MVC attributes ( HttpGet , HttpPost , etc.) allow me to have a controller with multiple actions sharing the same name, but they still must have different method signatures. Route constraints happen in the routing module before MVC kicks in and would result in me having 4 explicit routes, and still require