I have a route added by the code
routes.MapRoute("MyRoute", "TheUrl", new { controller = "MyController", action = "MyAction" });
I can then do a reverse lookup with the arguments like UrlHelper.Action("MyAction", "MyController"), and it will return a nice url like ~/TheUrl
However, for this route I want the generated URL to be ~/TheU...
Hi,
I'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario ...
I have a small site I am working on where I need to have 3 different routes such as:
.com/id/foo
2 .com/id/foo/bar
3 .com/id/foo/bar/user
So number 1 would be for the id of foo.
Route 2 would be the id of bar.
Finally route 3 would be the id of the user.
How would I set the routes up to do this?
...
Why does the following Html.ActionLink call:
Html.ActionLink("Approve", "Advance", new { id = Model.ID, step = StepType.Approve })
generate a URL with query parameters rather than a "restful" URL, i.e.:
http://localhost/Website/Case/Advance/1?step=Refer
I only have the default route registered, do I need additional routes that can ...
My question is fairly simple, in an app I'm building, there is no need to show a user's account as a separate action from editing a user's account. That is, instead of
URL | HTTP Verb | Action
============================================
/account/new | GET | new
/account/edit | GET | edit
/account | ...
Hi there,
Brain's a little fried....How do I get a hash of the :controller and :action from a relative_path?
This is basically the opposite of url_for. in the example below, "some_function" is the mystery function name I'm looking for...I know it's easy, just can't remember or seem to be able to find it in the docs.
Like so:
some_fun...
This is not an MVC topic.
I have an ASP.NET Application which performs URL Routing in the Application_Start method.
The routing looks like:
RouteTable.Routes.Add(new Route(
"Profile/{query}",
new RouteValueDictionary() { {"query",string.Empty} },
new GenericRouteHandler("~/ProfileHttpHandler.ashx")
));
A GenericRouteHandler loo...
I'm at a loss as to why my routes are conflicting. I have these in my Global.asax file:
routes.MapRoute(
"CustomerView", "{controller}/{action}/{username}",
new { controller = "Home", action = "Index", username = "" }
);
routes.MapRoute(
"Default", "{controller}/{action}/{id}",
ne...
I am working on a project in ruby on rails and I am having a very difficult time with a basic problem. I am trying to call a custom action in one of my controllers, but the request is somehow getting redirected to the default 'show' action and I cannot figure out why.
link in edit.html.erb:
<%= link_to 'Mass Text Entry', :action=>"crea...
I want clean URLs and have defined two routes:
routes.MapRoute(
"Search",
"Search",
new { controller = "Search", action = "SearchPanel" }
);
routes.MapRoute(
"SearchResults",
"Search/{content}",
new { controller = "Search", action = "Search", content = string.Empty, query = string.Empty, index = 0 }
);
then I h...
I am using Codeigniter with the HMVC Modular extension and have a backend CMS area for managing website content. I am routing the base URL + "admin" (http://localhost/cms/admin) to controller methods with the prefix "admin_".
e.g. function admin_index() {...}
And here is my routing:
$route['admin/([a-zA-Z]+)/(:any)'] = "$1/admin_$2...
How can I retrieve a site-wide URL parameter in a route without cluttering each controller action with a parameter? My question is similar to this question, but I want to avoid the ModelBinder clutter. Ie. in Global.asax.cs:
routes.MapRoute(
"Default", // Route name
"{sitename}/{controller}/{action}/{id}",
new { sitename = "...
Hi,
Many hosting companies let you define which page will be shown to the user if the user goes to a page that does not exist. If you define some .aspx page then it will execute and be shown.
My question is, why not use this for routing. since I can parse the users URL and then do a server.transfer to the page I want. I checked and the...
Our company is developing an API for our products and we are thinking about using ASP.NET MVC. While designing our API, we decided to use calls like the one below for the user to request information from the API in XML format:
http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist=cher&api_key=b25b959554ed76058ac220b7...
I have several models with translations. When I load
$this->tour = $this->getRoute()->getObject();
por example, it gets me the Tour Object. However, it doesn't join to the tour_translation table; so when after i try to get it's title; symfony makes another sql query.
How I can override something, so in the Tour model when I ask for t...
I'm trying to figure out how to structure my path on a link_to_remote tag to accommodate nested routes. I have an article model that belongs to a group model, and the article has votes associated with it (using the Vote_Fu plugin). I created the code for articles first and it worked, but in the process of adding the group model and updat...
How would i go about routing www.homepage.com/site/about to www.homepage.com/about for example? I still would like to use "site" as a controller, I just want to remove it from the route.
On a separate note, ss this how you usually setup routes for pages like about and contact that appear right after the site name?
...
On a skeleton ASP.MVC that Visual Studio creates, I add a script tag to my head section in Site.Master:
<script src="~/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
This causes the page to not render. In my case, I had a custom controllerfactory and the base method GetControllerInstance threw an exception:
The control...
I have an Html.Actionlink to which I am trying to add a "class" and an ActiveClass.
<%= Html.ActionLink("Home", "Home", "Account", null,
new {@class ="some-class"},
Html.RenderLinkClassIfActive("Home", "Account", "active")) %>
However, this doesn't work. What can I differently to make this work?
...
I have admin routing enabled. How can I set routing, to make http://website.com/admin go to posts/admin_index?
I've got this:
Router::connect('/', array('controller' => 'posts', 'action' => 'index'));
But it doesn't seem to work. I get this error (when going to http://website.com/admin):
Missing Controller
Error: Controller could n...