url-routing

Using LinkBuilder.BuildUrlFromExpression

I'm trying to use LinkBuilder.BuildUrlFromExpression from the Microsoft.Web.Mvc inside an ActionFilter and am wondering if this is the best way to get urls using strongly typed parameters: LinkBuilder.BuildUrlFromExpression<HomeController>(filterContext.RequestContext, RouteTable.Routes, x => x.Login()); ...

Rails link_to_remote degradation and url_for

Hello I am trying to create a link to destroy and entry in the DB using AJAX but I also want it to function without JavaScript enabled However the following code <%=link_to_remote "Delete", :update => "section_phone", :url => {:controller => "phone_numbers", :action => "destroy", :id => phone_number_display.id }, :href => url_for(:con...

ASP.Net MVC MapRoute problem

There seem to be a lot of issues on SO dealing with MapRoute problems. I've read through a bunch of them, but I can't see what I'm doing wrong in my implementation. I've got the following routes set up: routes.MapRoute( _ "FilesDisplay", _ "{controller}/{action}/{year}/{month}", _ New With {.controller = "Files", .action = "...

TinyURL like routing with ASP.NET MVC?

I'm attempting to write a TinyURL like clone in ASP.NET MVC as a first project to get used to the framework. The URL routing is still a little confusing for me, especially when I deviate from the controller/action/id. Can any of you ASP.NET MVC ninjas help me setup a simple URL route similar to how TinyURL.com processes its routes? ...

ASP.NET MVC URL Routing with Multiple Route Values

I am having trouble with Html.ActionLink when I have a route that takes more than one parameter. For example, given the following routes defined in my Global.asax file: routes.MapRoute( "Default", // Route name "{controller}.mvc/{action}/{id}", // URL with pa...

How can I implement Dynamic Routing with my choice of URL format?

My URL requirement is countryname/statename/cityname. For this I'm writing my own RouteHandler and adding one new route into the routecollection like this: routes.Add(new Route("{*data}", new RouteValueDictionary(new { controller = "Location", action = "GetLocations" ...

asp.net mvc url routing - sub folder name

Hi there I would like to create a url just like followings : http://localhost/news/announcement/index http://localhost/news/health/index http://localhost/news/policy/index announcement, health, policy are controller so I make a new url route map like this : routes.MapRoute( "News", "news/{controller}/{action}/{id}", new { control...

www to non-www redirection .htaccess code not woking on my site?

I want to redirect http://www.example.com to http://example.com via .htaccess. I've found and tried below listed codes but nothing works. can any body tell me the solution. I get this error Socket Error 10049 on all codes when i type http://www.example.com My hosting's Apache version is 2.0.63. My .htaccess file is in a public_html/ O...

URL routes - registering problem

Hello All. I've been using ASP.NET MVC for a few weeks, looking screencast, reading tutorials and so on. It turns out to be very interesting technology for me and I started to experimenting with it. I wrote simple web application which simply gets data from one table and shows it. All works fine on my dev environment, but when I tried ...

ASP.NET MVC: Form Input to pretty URLs

I have a URL: Shipment/Search/{searchType}/{searchValue} and a controller action: // ShipmentSearchType is an enum ... PartNumber, CustomerOrder, etc... ActionResult Search(ShipmentSearchType searchType, string searchValue) So this means I can type in pretty urls like: Shipment/Search/PartNumber/Widget-01 And get a list of all the...

ASP.NET MVC Why doesn't my routing work after publish?

Hi, i've got the following routeMaps setup for my website. Running and debugging locally works perfectly. I can publish the website to my server (www) but only the root page works (http://www.domain.com). As soon as I specify a controller (http://www.domain.com/Project) it stops working... What am i doing wrong? Global.asax.vb ' Note...

How to route sub-domains to account pages? How does domain masking work?

Part 1 I want to build a PHP Zend Framework application that users can sign up to use. When they register, I would like the application to create a sub-domain that points to their public page, that serves up content specific to that client. For example: http://mywebapp.com/username or http://username.mywebapp.com Update: "Using sub-do...

How to add a prefix to all actions with ASP.Net MVC URL Routing?

I'm trying to write a MapRoute call that will make any route that is prefixed with "json/" prepend "json" to the action's name. For instance, a route something like this: "json/{controller}/{action}" with "json/Foo/Bar", it should result in: controller = "Foo" action = "jsonBar" Any ideas? ...

.htaccess and seo-friendly urls

We have an ecommerce site right now that carries a range of brands. The brand pages carry urls as follows: http://www.&lt;DOMAIN&gt;.com/catalog/brand/view?id=2 We need to utilize more friendly (seo-friendly) urls such as: http://www.&lt;DOMAIN&gt;.com/&lt;BRAND&gt; but such that it would resolve #1 above. Is this done in .htacc...

Custom a catch-all parameter in routing

Hi Geeks, I recently want to have a special routing rule : {*whatever}/details/{Id}/{itemName} I know an exception will be thrown once I run the application. In my application, for example my url pattern is www.domain.com/root/parent/child/.../child/details/30/itemname but the current routing doesnot support this. How can custom the r...

ASP.NET URL Routing with WebForms - Using the SiteMap

I'm trying to use Url Routing within my existing ASP.NET WebForms site. Thanks to: this link, I got it working. Now I'm trying to use a SiteMap along with my routing. I have a page MyReport.aspx. It is in the SiteMap and accessing the page directly, works fine. I've added a route for /report/{param1}/{param2}. I was hoping the site...

Migrating an existing PHP site to use URL re-writing (Pretty URL's)

I currently have a community site that I run that is made up of 15 or so php pages. It is not currently very dynamic, only using php for includes/templates. Currently no content is generated via a query string. The pages do not follow a standard naming convention and there are many inbound links. I am looking to expand the site (and st...

WebForms custom / dynamic routing

I'm using Phil Haack's URL routing for WebForms and I would like to define a route that's "dynamic." Let's say I have this route: "{any}.aspx" -- goes to --> "~/PageProcessor.aspx" This would take any request that's not a physical page to the PageProcessor page. This works great. The problem is that, based on some data that comes from ...

ASP.NET MVC Routing Via Method Attributes

In the StackOverflow Podcast #54, Jeff mentions they register their URL routes in the StackOverflow codebase via an attribute above the method that handles the route. Sounds like a good concept (with the caveat that Phil Haack brought up regarding route priorities). Could someone provide some sample to to make this happen? Also, any "b...

How do I divide URL parameters in a URL route?

How would I set up the URL routing for a scenario such as this: www.website.com/[project name]/News/Submit/[possible extra parameters] [project name] = a variable that will be needed by the action to specify which project News = Controller Submit = Action [possible extra parameters] = id I have yet to run into any examples of how to a...