Is it possible, from within ASP.NET MVC, to route to different controllers or actions based on the accessing device/browser?
I'm thinking of setting up alternative actions and views for some parts of my website in case it is accessed from the iPhone, to optimize display and functionality of it. I don't want to create a completely separ...
Part of my application maps resources stored in a number of locations onto web URLs like this:
http://servername/Issue.aspx/Details?issueID=1504/productId=2345
Is it possible to construct an MVC route that matches this so that I get the path in its entirety passed into my controller? Either as a single string or possibly as an params s...
I'm calling an ActionResult (/Listing/ChangeEmail) from a jQuery dialog that is showing a partial view (ChangeEmailAddress.ascx), which is launched from View (Details.aspx).
ChangeEmail = function () {
var newEmailAddress = $("#EmailAddress").attr("value");
$.ajax(
{
url: '/Listing/ChangeEmail',...
Hi,
I'm having some weird behaviour when i use the following code inside the httapplication:
protected void Application_PostAuthenticateRequest
{
RouteData Data = RouteTable.Routes.GetRouteData(new HttpContextWrapper(Context));
string x = Data.GetRequiredString("xxx");
}
When that code is in place, the html pages are missing all ima...
I'm moving my home-baked web site to MVC and got the trouble with url routing. The site already serves several links that contain tilde (~) character in the path; something like
http://.../~files/...
http://.../~ws/...
and I want each of them are handled by separate controller, like filesController, wsController, so my route table loo...
I have spent several hours today reading up on doing Custom Routing in ASP.NET MVC. I can understand how to do any type of custom route if it expands from or is similar/smaller than the Default Route. However, I am trying figure out how to do a route similar to:
/Language/{LanguageID}/Question/{QuestionID}/
And what I would like, too,...
is there any way to find out to which route my url is getting mapped in asp.net mvc.
...
I want to define a route that have 2 optional parameters in the middle of the URL the start an end parameters are digits
routes.MapRoute(
"",
"Source/Changeset/{start}/{end}/{*path}",
new {
controller = "Source",
action = "Changeset",
...
I have a website (not a web application- in visual studio you get two options-create a website/project) running on IIS 6.0. Now I want to develop few features in MVC architecture.
So I created one MVC application in visual studio and everything is working fine on localhost as a separate application. Now I want to host this MVC app also i...
In a brand new ASP.NET MVC2 project, I want the user to be redirected to
http://<mysite>/home/index
rather than
http://<mysite>/
We do this with our other sites for tracking purposes, to avoid the scenario where hits to the same default page show up as
http://<mysite>/
http://<mysite>/default.aspx
How...
I am migrating a site from ASP.NET MVC 1 to ASP.NET MVC 2. At the moment, the site supports the following routes:
/{country}/{language}/{controller}/{action}
/{country}/{controller}/{action}
/{language}/{controller}/{action}
/{controller}/{action}
The formats for country and language are distinguishable by Regex and have suitable cons...
I am adding some MVC features to an existing site (FWIW, most of which is in classic ASP). As a result, I need to keep the default routing going to ~/default.asp (at a minimum - preferably the default document specified in IIS).
Is there a way to write the route in RegisterRoutes so that a request for the root of the site (e.g., http:/...
Hi I'm pretty new with MVC2 or MVC in general. If it's one thing I get caught up with it's routes. Like now I got this scenario. Im going from the regular site to Admin. My navigation is the same partialview on both I just do a check which data to render something like this.
<% if (!Request.RawUrl.Contains("Admin")){%>
<% foreach (var ...
So we have a route setup that has a wildcard at the end to capture a file path, the route might look like:
/{browserName}/{browserVersion}/{locale}/{*packageName}
The problem comes in when we try a path like:
/FF/3/en-US/scripts/packages/6/super.js
What ends up getting passed to the controller as packageName is:
/scripts/packages/su...
I am still very new to routing with asp.net mvc, so perhaps this is obvious and I am just missing the answer...
I have a controller named 'pages', and it has several action results, 'Information', 'History' etc. Each action result takes a string, and from that, it returns a View based on the name of the string. So...
Pages/Informatio...
We have recently shifted to asp.net mvc, but we still need to support some legacy urls. What is the best way to handle this situation. Is it Application_PreRequestHandlerExecute() event in global.asax, that I need to use or is there any better way?
...
I am having one of those coder's block days. I should know this but instead I'll ask for a little help. I have two routes:
/Login
/Login?wa=wsignin1.0&wtrealm=http://localhost/MyApp
Accessing the Action method for the first with an HTTP GET returns the login page where-as the second does some federated authentication stuff. I defin...
In my ASP.NET MVC application, I want to use this ASP.NET MVC Attribute Based Route Mapper, first announced here.
So far, I understand how to implement code that uses it, but I've run into a few questions that I think those who have used this attribute-based route mapper in the past will be able to answer.
How do I use it with ActionR...
I have the following URL in mind:
/restaurants/italian/miami.html
/restaurants/italian/miami-p2.html
Using these routes
routes.MapRoute(null, "{category}/{branch}/{city}-p{page}.html",
new { controller = "Branch", action = "Index" });
routes.MapRoute(null, "{category}/{branch}/{city}.html",
new { contr...
I'm trying to create URIs that look a little something like this:
http://hostname/mobile/en/controller/action for mobiles OR http://hostnamem/en/controller/action for desktop (non mobiles)
My Route table currently looks like this (Global.asax.cs)
` routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
...