Questions about routing within ASP.NET (including MVC).
1
vote
1answer
17 views
How to handle ASP MVC Url Parameter containing forward slash
I am working on a ASP.Net MVC project. I have a particular controller action that accepts a date value in the form yyyy/mm/dd. So the URL becomes
...
1
vote
2answers
61 views
ASP.NET MVC different routing for different actions
I am building a Site using ASP.NET MVC. In RouteConfig, I modified the method like this:
public static void RegisterRoutes(RouteCollection routes)
{
...
0
votes
3answers
51 views
Deploying MVC Area as a self standing web site
I have an MVC Application with multiple Areas. They share a lot of common code and components, so I do not want to break them up into separate Projects. But I would like to deploy them to separate ...
0
votes
1answer
12 views
Passing querystrings to RedirectToRouteResult (beside controller and action)
I have the following code:
var routeDictionary = new RouteValueDictionary {{"action", "Login"}, {"controller", "Persons"}};
filterContext.Result = new RedirectToRouteResult(routeDictionary);
That ...
0
votes
2answers
43 views
parameter only in url
I trying to achieve a URL of
http://www.dgcportal.com/Services
I am using this in my RegisterRoutes method:
routes.MapRoute(
name: "Categories",
url: ...
0
votes
1answer
30 views
MVC URL routing is not working
This is my Global.asax , all I want to map another url format to controller and action.
//Matching to auctions-index-Testing
//Why this one is not matching to auction-index
...
0
votes
1answer
12 views
Calling HttpHandler from an area
I have a simple asp.net mvc 4 website with an admin area. I have defined a custom http handler to handle uploads from a plupload script that runs in the admin area. Here is the code for the handler :
...
1
vote
1answer
37 views
MVC4 : Twitter bootstrap MVC4 sample package. child route in navigation based on user role
I'm asking lots of question today but anyways,
I installed a package called Twitter bootstrap for asp.net mvc 4 sample to my default mvc4 empty project. To be honest it looks much better than default ...
0
votes
2answers
43 views
asp.net mvc routing with $routeProvider
Is there any sane way to use these?
What I want to have - is a single page with a nav-menu and <ng-view> below it.
And all the routing should be angular's responsibility.
But, I'd like to ...
0
votes
1answer
31 views
Get Action URL inside MVC4 .NET class
Basically, I want the same functionality as Url.Action, but outside of the controller. Is this possible?
While I'm sure I'll use it elsewhere, my current desire is to generate action url's inside of ...
0
votes
2answers
40 views
MVC 4 querystring value with period
I am implementing OAuth2 into my MVC project.
At the moment I am working with Google Api. The first step worked fine and my callback URL is being called with a parameter code which looks like this:
...
1
vote
1answer
41 views
How to shorten the url to just the action parameter
If a website with url "www.site.com", redirects to HomeController's Index action.
I have
www.site.com/area/controller/action/{nick}
I want the url
www.site.com/{nick}
do the same thing
How ...
0
votes
3answers
54 views
Routing a .GIF one way, the rest of the MVC 4 site another
I've been trawling through 1000s of questions and blogs and still don't fully understand dam routing!
Along the lines of Scott Hanselman's blog I am trying to route a certain call to a .GIF to a ...
0
votes
1answer
34 views
MVC routing mystery
I have a simple app that was created using MVC4 and Internet Application template. I excluded the followings and deployed to a IIS7 server.
/App_Start/AuthConfig.cs
...
0
votes
1answer
27 views
MVC Reroute to accept Key
working on an MVC project and I'm having a tough time with rerouting my URL.
What I currently have is
http://dev.mywebsite.com/s/index?Key=abc123
which then runs the index action and completes as ...
0
votes
3answers
58 views
ASP.NET MVC routing issue
I am using asp.net mvc 4 . I want to work with 3 - 4 route pattern , but I can't . it works just with one pattern :
this is my RouteConfig file :
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
...
0
votes
2answers
38 views
Multiple routes , and dynamic Asp.net mvc pages
Im getting dynamically Url from database, and pass it into Multiple routes by 1 controller. And when put content body of url-items to the model of View. And the point is, that the new page start ...
-2
votes
3answers
57 views
MVC - Given a route name, can I get the default action name and controller name?
Given a route name, can I get the default action name and controller name?
routes.MapRoute(
name: "MonthlyCalendar",
url: "FMB/Calendar/{jamaatName}/{year}/{month}",
defaults: new { ...
0
votes
1answer
41 views
ASP.NET MVC 4 - 301 Redirects in RouteConfig.cs
How can I add a route to the RouteConfig.cs file in an ASP.NET MVC 4 app to perform a permanent 301 redirect to another route?
I would like certain different routes to point at the same controller ...
1
vote
1answer
45 views
ASP.NET MVC 4 - Can you produce friendly URLs with an ActionLink?
I have used ActionLinks to create a page link - for example:
@Html.ActionLink(p.Name, "Details", new { URL = p.URL })
This generates a URL like this:
...
0
votes
1answer
23 views
Is their any way to have different property name in input object and different property name in the parameter to action
I have a situation where I am passing some values from query string and some values I am getting from the custom routes segment.
for example my url is
...
2
votes
1answer
30 views
Is the default area for Html.BeginForm always the current area in ASP.NET MVC?
I had the following piece of code in my Razor Layout view (which is shared by all views in my application):
@using (Html.BeginForm("Logout", "Account", FormMethod.Post, new { id = ...
1
vote
1answer
39 views
Web Api route not found
I have already researched many of the questions regarding this topic. I'm no slouch when it comes to MVC3 but for the life of me I can't figure out why my Web Api in MVC 4 routing is failing.
...
2
votes
1answer
36 views
ASP.NET MapRoute with exact match constraint
I have mapped urls in my ASP.NET application as below:
context.MapRoute(
"Product_v1_DataExchange",
"v1/xch",
new { controller = "Data", action = ...
0
votes
4answers
79 views
ASP.NET MVC/WebAPI Routing actions
The goal is to allow these four endpoints:
POST v1/invoices
POST v1/invoices/12345
POST v1/invoices/12345/attachment
POST v1/invoices/12345/image
Routing entries:
routes.MapHttpRoute(
...
0
votes
0answers
33 views
Standard URL tries to call a controller action
I cannot get the following link to open. It tries to call and action instead: controller /action/ www.xyz.com. It should open a new window with the url of a website outside of my application.
@if ...
0
votes
0answers
20 views
How can i assign URL in MVC for a controller from within a class
I am creating a URL in one of my class which gets called from controller A, but my URL is for some action which is in controller B, How can get this to work, I have tried
HttpContextWrapper ...
1
vote
3answers
87 views
asp.net-mvc routing issue : parameters dictionary contains a null entry for parameter
I am trying to set up custom routing with the following mapped route
edit: my full route config
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: ...
2
votes
1answer
67 views
Routing a url with extension in MVC4 won't work, tries to serve up static file
I'm using MVC4 and need to route a request like this to a controller:
[myapp]/data/fileinfo.xml
Here is the route I have configured:
routes.MapRoute(
name: "Data",
url: ...
0
votes
1answer
22 views
MapRoute to remove action from url for single action
So I've read a bunch of answer, but I can't seem to understand what I'm doing wrong. Here's the route I am using
routes.MapRoute("project",
"project/{id}/{slug}",
new { ...
1
vote
1answer
28 views
Route Actions to same URL
I'd like to hide requests for several controllers 'create' action in a common url. The controllers all are in a sub-folder in the Controllers directory:
Controllers \ mydirectory \ controller1
...
1
vote
1answer
45 views
can not map a route for a specific controller in mvc 4
I have a controller named Registration and an action method in it as the following:
public JsonResult GetReqs(GridSettings gridSettings, int rt)
{
...//whatever
return ...
0
votes
0answers
28 views
MVC 4 routing issue
I am creating a profile site i MVC 4 and I have run into some issues with routing.
I have created a Area named Member that contains 2 Views, Profile and Message.
Routes that are registered are:
...
-1
votes
0answers
27 views
ASP.NET MVC and ROUTING, with prefix parameter in url
I am trying to write an MVC 4 application. It is based on a workspace principle meaning that every object is referenced to a unique workspace. The user would select a workspace in the UI and all ...
1
vote
2answers
66 views
MVC Double Encoding MvcHtmlString
Caveat: I have an MVC site as an area in a .Net WebForms site. I'm explaining that in advance in the case that it sheds light on my issue.
Now the issue I am having is that I am routing values that ...
1
vote
1answer
51 views
setting custom path in routeconfig.cs in mvc 4
Below is my routeconfig.cs file in mvc4 application
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
...
0
votes
2answers
46 views
How can I return a view(model) and also pass a query string param to the view?
I have an MVC app where users fill in a 4-step form then go to a "confirm" screen. On the confirm screen, if they select to modify their info I use RedirectToAction to take them back to the first step ...
0
votes
1answer
50 views
ASP.NET MVC Routing with IIS Default Application with Alias
I am having a website, say www.mywebsite.com, to which I want to add my ASP.NET MVC application which could be accessible from the link www.mywebsite.com/MyApplication. The problem begins when the ...
0
votes
0answers
24 views
Route for favicon
I have a .net mvc4 application that has a multitentant solution.
The way this is set up is that it tries to get a file for the client, and if not found it takes the global file.
All this works great ...
0
votes
0answers
60 views
Generate wrong outgoing url because of segment variable reuse in MVC 4
Here is my RouteConfig.cs
routes.MapRoute(null,
"{controller}/Page{page}",
new {controller = "Product", action = "Index", category = (string) null},
...
0
votes
1answer
48 views
ASP.NETMVC routing looping forever
I'm quite new to MVC routing so please bear with me if this is too trivial.
I have created the following route:
routes.MapRoute("ProductSearch", ...
1
vote
2answers
50 views
How to configure routes to have default Get and named Get method in WebApiConfig?
I want to create the following API:
/api/verifications/1
/api/verifications/getfoo/1
Controller methods:
public string Get(int id)
{
return "value";
}
public string ...
1
vote
1answer
55 views
Confusion about VirtualPathProvider, bundling, embedded static files an views
I am trying to share SOME static files(css, images, scripts) and SOME views from separate libraries to few MVC applications, here is my directory structure:
Solution
Directory 1
MyContent
...
1
vote
3answers
100 views
Hide a QueryString parameters, how?
I have a url: like this one: http://www.example/about/49.
I want it to be seen as http://www.example/about/, but I must have this parameters passed as QueryString parameters.
Is it possible ?
0
votes
1answer
27 views
Url with email address in ASP.NET MVC4
I have a situation where I'm using URLs that could possibly contain email addresses. For example:
http://MyUrl.com/Edit/Mike
or
http://MyUrl.com/Edit/[email protected]
According to this ...
0
votes
1answer
76 views
How to access the current HttpRequestMessage object globally?
I have a method which creates an HttpResponseMessage containing an Error object which will be returned based on the current request media type formatter.
Currently, I have hardcoded the ...
0
votes
0answers
43 views
Custom file extension handling in MVC4
I'm trying to handle my specific file extensions with my custom http handler.
The dll I'm using was working perfectly for webforms, so I want to reuse it for mvc applications.
I added handlers to ...
2
votes
1answer
291 views
@Html.Action MVC 4 with QueryString Parameters
I have a question related to the Html.Action in MVC 4
I want to pass some Querystring Variables with it to the Details view
The code I have now is
System.Text.StringBuilder MobileData = new ...
1
vote
1answer
48 views
How to know when Web API Routing Engine Doesn't Find a Matching Service?
I'd like to log the requests to my Web API application that results in 404 (which means the routing engine couldn't find a matching service).
How would that be possible?
For example, if I have the ...
-1
votes
1answer
49 views
Public action method was not found on controller
I have the following controller method:
public ActionResult GetResults(string viewToReturn, int resultsPerPage,
string classification = null, string sessionId = null, int? lastId= null)
{
...