Questions tagged [maproute]
148 questions
8
votes
4 answers
C# MVC 4 ControllerName attribute
I'm working on providing friendly names for my MVC 4 controllers and I want to do something like the [ActionName="My-Friendly-Name"] style, but for the whole controller.
I couldn't find any information about such an attribute, so how would I go…

joe_coolish
- 7,201
- 13
- 64
- 111
8
votes
1 answer
Custom MapRoute
I am attempting to create some custom map routes but can't get it working quite right.
My ultimate aim is to be able to specify something like the following. Where by I essentially have my URL constructed with value pairs of "id" and "name". The…

Chris
- 26,744
- 48
- 193
- 345
6
votes
3 answers
MVC 3 How to use MapRoute
Could someone show me how to use the MapRoute method? I have tried creating my own routes, but it's not working. What i want to accomplish is a route that routes "http://servername/home/default.aspx" into controller "Home" and action "Default".…

Anton Gildebrand
- 3,641
- 12
- 50
- 86
5
votes
2 answers
MVC routing static file
I am working with a legacy swf file that is looking in the controller/action routing for a static route. For example, it is trying to download the file
http://localhost:59801/Resource/Details/ClearExternalPlaySeekMute.swf
When the file exists in…

user547794
- 14,263
- 36
- 103
- 152
4
votes
1 answer
MVC3 MapRoute, parameter with slashes
How would i create a MapRoute that accepts slashes without considering it a new parameter?
If the url is
http://localhost/root/p1/default.aspx
I want one parameter to pick up everything after localhost (root/p1/default.aspx). Normally it would take…

Anton Gildebrand
- 3,641
- 12
- 50
- 86
4
votes
2 answers
how to map a Route like (site.com/username) in MVC 3
I want to map a route like this:
mysite.com/username
in ASP.NET MVC 3 application; How can I do it, please?
Thanks to all, regards

amiry jd
- 27,021
- 30
- 116
- 215
4
votes
1 answer
MapPageRoute routeUrl hitting 403 on specific request
I currently using global.asax for my page routing on my website.
Except I have the following code:
//Home:
routes.MapPageRoute("intro", String.Empty, "~/Default.aspx");
routes.MapPageRoute("home", "home",…

Niels
- 416
- 5
- 22
4
votes
1 answer
c# MVC 5 RouteConfig redirection
Recently I had to update my mvc webapplication so that a basic entity of the system is displayed in the UI with a different literal.
Lets say
Previously I had: "Vessels"
Now I am asked to make it: "Ships"
The urls where mapped as by convention:…

cnom
- 3,071
- 4
- 30
- 60
4
votes
1 answer
Registering Multiple Routes in MVC asp.net
I want to map several routes in MVC that have the parameters in different orders:
localhost:1010/abcd/home/index
localhost:1010/home/index/abcd
id=abcd
controller=home
action=index
I tried the code below, but it doesn't work.
public static void…

Ahmad
- 343
- 1
- 3
- 12
3
votes
1 answer
Why is ASP.NET MVC MapRoute popping up a Windows authentication dialog box?
This one has me stumped, and I think it might be a bug in Microsoft's MVC implementation. I am building a MVC website using VS2008 SP1. In an attempt to lockdown my website I edited my controller to look like this:
1 public class IdeaController…

Whozumommy
- 3,203
- 7
- 29
- 22
3
votes
3 answers
How do I redirect everything to a single controller?
I have three specific routes:
routes.MapRoute(
"Home Page",
"",
new { controller = "Home", action = "Index" }
);
routes.MapRoute(
"Admin Section",
"AdminSection/{action}/{id}",
new {…

Wil
- 10,234
- 12
- 54
- 81
3
votes
2 answers
Is it possible to have route multiple parameters in asp.net mvc using maproute
I want a user to be able to access objects (could be JSON or XML) using a restful syntax rather than having to use query strings.
So instead of http://mywebsite.com/objects/get=obj1&get=obj2&get=someotherobject/ they could do something like…

Darcy
- 5,228
- 12
- 53
- 79
3
votes
1 answer
How can create a route to main project MVC to another project MVC?
I have one solution with two project MVC. I added a references to second project to main project. I create a new MapRoute in first project to second project.
routes.MapRoute(
name: "second",
url: "second",
defaults:…

Ciprian Jijie
- 479
- 5
- 20
3
votes
1 answer
Asp.net MVC 5 MapRoute for multiple routes
I have 3 routes in RouteConfig:
routes.MapRoute(
name: "ByGroupName",
url: "catalog/{categoryname}/{groupname}",
defaults: new { controller = "Catalog", action = "Catalog" }
);
routes.MapRoute(
name: "ByCatName",
url:…

Ssocial.it Web Agency
- 81
- 1
- 2
- 9
3
votes
2 answers
routes.LowercaseUrls and routes.AppendTrailingSlash not work in MVC
I am developing mv4 website,
would you please tell me why these command do not do anything in my application when I write them into RouteConfig:
routes.LowercaseUrls = true;
routes.AppendTrailingSlash = true;

Sepehr Estaki
- 331
- 5
- 19