Questions tagged [mvcroutehandler]

Questions about routing within ASP.Net MVC

36 questions
6
votes
1 answer

Use custom route handler with MVC5 attribute routing

Using the library AttributeRouting, I was able to configure attribute routing to use a custom route handler (inheriting MvcRouteHandler): routes.MapAttributeRoutes(cfg => { cfg.UseRouteHandler(() => new MultiCultureMvcRouteHandler()); …
4
votes
2 answers

MVC C# custom MvcRouteHandler - How to?

Does anyone have experiences in providing a custom MvcRouteHandler? In my application I'd like to implement a globalization-pattern like http://mydomain/en/about or http://mydomain/de/about. As for persistance, I'd like to have a cookie read as…
Mats
  • 14,902
  • 33
  • 78
  • 110
4
votes
2 answers

.net mvc route default controller/action but not default parameters

I created this route routes.MapRoute( name: "Survey", url: "{controller}/{action}/{surveyid}/{userid}/{hash}", defaults: new { controller = "Home", action = "Survey" }, …
2
votes
1 answer

How to specify namespace in custom route handler for MVC3?

I have written a custom route handler. Because I have Areas in my web site with conflicting controller names, I am getting the error: Multiple types were found that match the controller named... I think I need to specify a namespace in my handler,…
2
votes
1 answer

How to fall back from a custom MvcRouteHandler to next one in Route Table

I have a custom MvcRouteHandler which checks database if a Url exists and pairs it with some controller action and Id. However if this route handler can not find a matching pair in database, I'd like MVC to keep try with other defined route handlers…
Bogac
  • 3,596
  • 6
  • 35
  • 58
2
votes
1 answer

Routing static files with ASP.net MVC from a different directory without IIS changes and with authentication

Lets stay I store content for a single user of my application at: C:\Files{GUID}\ Those files may be something like: C:\Files{GUID}\bunny.jpg C:\Files{GUID}\unicorn.html The end user should be presented with a "friendly" url. http://…
1
vote
1 answer

.NET MVC URL Routing Help

I am trying to configure an ErrorController in my .NET MVC application, and I am unable to hit any actions on the controller currently, so I believe it may be because I need to register the URL route in the global.asax The Error controller is the…
TheJediCowboy
  • 8,924
  • 28
  • 136
  • 208
1
vote
1 answer

MVC 3 HyphenatedRouteHandler not compatible with Areas and duplicate controller names

I'm fairly new to MVC3, but I've spent quite a bit of time researching this and testing, and I cannot find a solution. There is another similar post on Stack, but it's unanswered after 7 months. The crux is this: If you have areas and controllers…
1
vote
1 answer

MVC route with single level

I need to build a controller action to handle this pattern: example.com/aString where aString can be any of a set of arbitrary strings. The controller would cycle thru each of the possible values and, if none match, redirect to a 404. I'd think it's…
justSteve
  • 5,444
  • 19
  • 72
  • 137
1
vote
0 answers

Changing the home page is not working

In my project the initial route config was like below public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", …
Sachu
  • 7,555
  • 7
  • 55
  • 94
1
vote
1 answer

ASP.NET MVC 5: single controller method to handle paths in file browser mode

I want to have some controller with the single method that would allow me to navigate through some hierarchy (file system etc.). In other words I want to have possibility to access this method with flexible routes and get part of routes as…
Mr. Pumpkin
  • 6,212
  • 6
  • 44
  • 60
1
vote
1 answer

Create subdomain on the fly like blogger.com using asp.net mvc

I want to create sub domains on the fly for each of my identity users (AspNetUsers). You can see this kind of feature available in blogger.com. I have list of sub domain names in the database Users={"abc", "xyz","blah"} My original website is…
1
vote
1 answer

Creating a failover route in MVC 5

I would like it if any Url that is not found is sent to my "Home" controller. And I mean like total garbage urls passed in Like SomeDomain/ThisIsNotAController/Goober/adsfasdf1?spacerocket. A 404 error is just confusing to many people. How do I map…
1
vote
1 answer

RouteValueDictionary being passed by default in MVC4

I have encountered a problem while upgrading to MVC4 and I was wondering if anyone else has seen this problem and how to get around it. Whenever I put a IDictionary, Dictionary or RouteValueDictionary to the parameter list of an action, the route…
Lee Vaughn-Ogin
  • 429
  • 4
  • 9
1
vote
1 answer

RequireHttpsAttribute and Encrypted Request Data

I have a controller action that is accepting sensitive data. public ActionResult TakeSensitiveData(SensitiveData data){ data.SaveSomewhere(); } To ensure the data is secure I want to be certain requests are made using HTTPS (SSLv3, TLS 1). One of…
goatshepard
  • 1,063
  • 1
  • 8
  • 18
1
2 3