url-routing

asp.net 3.5 url rewriting / routing for multilingual websites

Hello, I'd like to implement the asp.net 3.5 url routing functionality to take in links like www.mysite.com/fr/blah/page1.aspx www.mysite.com/en/blah/page1.aspx and redirect them to the same page. I've read through and tried the approach in the following tutorial: http://aspnet.4guysfromrolla.com/articles/051309-1.aspx. However this t...

Shortening URL params with MVC routing.

I have a url along the lines of this: example.com/profile/publicview?profileKey=5 and I want to shorten it to this with routing example.com/profile/5 How do I do this? This is my attempt: routes.MapRoute( "Profile", "Profile/{profileKey}", new { controller = "Profile", action = "PublicView", profileKey ="" } ); B...

Is there a way to maintain IsAjaxRequest() across RedirectToAction?

If you don't want any context or an example of why I need this, then skip to The question(s) at the bottom! In a bid to keep things tidy I initially built my application without JavaScript. I am now attempting to add a layer of unobtrusive JavaScript on the top of it. In the spirit of MVC I took advantage of the easy routing and re-rou...

Configure UrlReplacer to only work for specific IP addresses

I'm using a utility called UrlReplacer to enable the configuration of friendly Urls for a website I'm working on. The website is developed in Asp.Net 3.5 and uses Immediacy CMS. We need to allow the client to manage their own friendly URLs. Is there any way that UrlReplacer can be set up so that the configuration page is only visible t...

URL Rewriting with UrlRewriter.Net, ASP.NET MVC Routing or What Do You Recommend?

I'm just wondering, if you are creating a new ASP.NET web forms app in ASP.NET 3.5, which would you recommend for URL rewriting? UrlRewriter.NET or ASP.NET MVC Routing. I've used UrlRewriter.NET before and was pretty happy with it. Opinions anyone? ...

How to Implement URL Routing in PHP. Im a newcomer to know this concept. Help me

I need to know how to implement URL Routing in PHP. Im a Amateur PHP Developer. Guide me. Any Help would be greatly appreciated ...

Determine Final Destination of a Shortened URL in PHP?

Hey, How can I do this in PHP? e.g. bit.ly/f00b4r ==> http://www.google.com/search?q=cute+kittens In Java, the solution is this: You should issue a HEAD request to the url using a HttpWebRequest instance. In the returned HttpWebResponse, check the ResponseUri. Just make sure the AllowAutoRedirect is set to true on t...

Form submission with errors displays form + errors at a different URL from the original form

I'm working on a relatively simple website with (currently) a single resource. I have a form at GET /maps/new that submits data for a new Map to POST /maps, which redirects to GET /maps/:id after completion. The problem here is that if validation fails, it renders the new-map form, so the URL is still /maps. But redirecting to /maps/new ...

Using SEO friendly URLs in ASP.NET

I am in a situation where I want to restructure my site's urls. That is I have a page that lists the article names (with each article name as a link). As shown below: ARTICLE1 ARTICLE2 ARTICLE3 Now if I click on an article I want the url to be as follows: www.domain.com/ArticleID/name-of-the-Article ...

How to show a custom 404 page in ASP.NET-MVC?

When any URL is 404 on my site, i want to show a custom 404 page that is rendered with ASP.NET-MVC. Hoewever i do not want to use the wildcard route approach because that would disable standard webforms. My code currently looks like this: if (serverException is HttpException && ((HttpException)serverException).GetHttpCode() == 404) { /...

ASP.NET MVC: Restricting access using url

The URL for the administration section of my website always starts with Admin/. Is it possible in ASP.NET MVC to restrict access to users by using this part of the URL? Obviously I would keep the [Authorize(Roles = "Administrator")] on appropriate controllers and actions but I wonder if it would be quicker for the application if it can ...

url routing doesn't work when publishing to another server

Hello, I've implemented url routing with the following rule: string virtualPath = "~/" + requestContext.RouteData.Values["page"].ToString(); //if virtualpath doesn't end in aspx, then it's just a directory path loading //default.aspx by default. if (!virtualPath.EndsWith(".aspx") && !virtualPath.EndsWith(".txt")) {...

url routing doesn't work for root folder.

Hello, I've implemented url routing under asp.net 3.5 with the following code: public IHttpHandler GetHttpHandler(RequestContext requestContext) { string virtualPath = requestContext.RouteData.Values["page"].ToString(); //if virtualpath doesn't end in aspx, then it's just a directory path loading ...

How can I ensure my website always opens as www.mysite.com and not mysite.com - this messed up my Google OpenID logins?

Hi guys, my website has a log in by open id feature. When a user logs in for the first time using his/ her openid they are redirected to a create account page. I noticed just recently that one user when logged in using her google account created an account for the first time. However when she tried to log in again using the same google a...

Add a trailing slash at the end of each url?

Hello SO Fellows! I have a little problem here. I need to add a trailing slash at the end of each url in the site I'm working on. I defined all the links inside the site to have a trailing slash like so: <a href="/register/">Register</a> While this works fine there's still one tiny issue: it's with the generated urls that come from...

How to Implement URL Routing with PHP + IIS?

I wrote a content switcher script that uses dynamic URLs to pass parameters indicating what data is to be sent. For example to view the about page you would type: http://www.example.com/?page=about The issue is that this is not user friendly especially in my case where users will not necessarily be accessing this page via a link from t...

Zend framework: Removing default routes

I'm using Zend FW 1.9.2, want to disable the default routes and supply my own. I really dislike the default /:controller/:action routing. The idea is to inject routes at init, and when the request cannot be routed to one of the injected routes it should be forwarded to the error controller. (by using the defaultly registere Zend_Control...

What is the best RESTful way to pass string collections as parameters?

I've got a rails application with RESTful-ish URLs where I need to pass in a collection of strings (tags), and I don't want to use the query string. Currently I'm using a route similar to /controller/tagged/:tags/foo/:foo/bar/:bar.:format This requires the 'tags' to be encoded which is a pain and error prone if you want to manually typ...

Django: runtime url configuration

If there is a painless way of runtime urlconf modifications? e.g. based on database records? Bruteforce soluttion: r('^(.*)/', handmade_router_function) is too brutal for me :) Thanks in advance! UPD: I understand that i can directly modify urlpatterns from my code, but it is requires a lot of hand-coding (custom admin-save actions...

.net mvc custom types in urls

Hi there, I'm building an asp.net mvc app that uses the default url route «/{controller}/{action}/{id}» My problem is with the last item in this route, the id. The mvc framework automatically casts whatever in put in the id to the type of the parameter declared in the action. example: url: /mycontroller/myaction/1 public class mycont...