routing

Why the query strings in my ASP.NET MVC route?

On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink will return to me URLs containing querying strings. I have isolated the circumstances that produce this behavior, but I still do not understand why, instead of producing a clean URL, it decides to using a query string parameter. I know that functionally they...

Postback not working with ASP.NET Routing (Validation of viewstate MAC failed)

Hi. I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/ All works fine, I have custom SEO urls and even the postback works. But there is a case where the postback always fails and I get a: Validation of viewstate MAC...

Redirect to controller (but with a different master) using a catchall wildcard

I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don't know where to start... I have several routes which catch various different types of urls that contain different structures. In the code snippet below, I have a product route, and then I have a partner site...

Is it possible to forward all traffic to an IP Address?

we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS records? Thanks. ...

URL Routing: Handling Spaces and Illegal Characters When Creating Friendly URLs

I've seen a lot of discussion on URL Routing, and LOTS of great suggestions... but in the real world, one thing I haven't seen discussed are: Creating Friendly URLs with Spaces and illegal characters Querying the DB Say you're building a Medical site, which has Articles with a Category and optional Subcategory. (1 to many). ( Could...

Is it possible to make an ASP.NET MVC route based on a subdomain?

Is it possible to have an ASP.NET MVC route that uses subdomain information to determine its route? For example: user1.domain.com goes to one place user2.domain.com goes to another? Or, can I make it so both of these go to the same controller/action with a username parameter? ...

Generate a URL with URL Routing in Webforms

I know in the MVC Framework, you have the Html Class to create URLs: Html.ActionLink("About us", "about", "home"); But what if you want to generate Urls in Webforms? I haven't found a really good resource on the details on generating URLs with Webforms. For example, if I'm generating routes like so: Route r = new Route("{country}/...

ASP.NET MVC - .mvc Routing just fails in II6

Hi, I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (linked question) I have scrapped wildcard mapping for the time being and am trying to get the .mvc extension working. Everything is configured correctly in IIS and the .mvc extension is pointing to the .NET dll for all verb types (unchecked verify...

Translate a url to a route

Hi there! I feel like I'm re-inventing the wheel here, but I need to find a way of taking a URL from a catchall,and redirecting that to another route. The reason for this is because I need to do some things like adding session cookies for certain urls, and then pass them on to their relevant action. What's the best way of implementing...

Custom Ruby Routes in Model

Okay, these two related questions are in reference to Railscast #21: I'm having some trouble with routes. Two issues: 1) The routes in the tutorial seem to be relative to the root of the application; I want them to be relative to the root of the model. So "http://example.com/login" I need to be "http://example.com/model/login" (and ...

Semantic urls with dots in .net

I'm trying to make semantic urls for search pages, but if someone use a search finished in dot, the .net engine return a 404. The request don't even get to the routing engine, so i think its something related to security or something like that. For example, the stackoverflow routes also don't work in these case: http://stackoverflow...

Using the greedy route parameter in the middle of a route definition

Hi, I'm trying to create routes which follow the structure of a tree navigation system, i.e I want to include the entire path in the tree in my route. So if I had a tree which looked like this Computers Software Development Graphics Hardware CPU Graphics cards Then I would like to be able to have routes that looks like this ...

Routing without namespace in Rails (2.2)

Related to the question asked here -- http://stackoverflow.com/questions/182040/default-segment-name-in-rails-resources-routing. Having trouble in edge rails trying to generate resources without a namespace prefix (i.e. /:apple_id/oranges/). Using the plugin gives me //:apple_id/oranges? Any easier way to do this? Maybe a 2.2 issue? ...

Can Asp.Net Mvc Route Constraints throw a 404 instead of InvalidOperationException?

I'm trying to use route constraints in an Asp.Net MVC Application. routes.MapRoute( "theRoute", "MyAction/{page}", new { controller = "TheController", action = "MyAction", page = 1 }, new { page = @"[0-9]" }); When I enter an url like ~/MyAction/aString, an YSOD is shown with an invalid operation exception. What can I...

RouteValueDictionary overridden by context

If you have a route: routes.MapRoute("search", "{controller}/{action}/{filter1}/{filter2}/{filter3}", _ New With {.filter1 = "", .filter2 = "", .filter3 = ""}) then in a view satisfied by the route pattern with a url of /member/search/dev/phil/hoy, when you attempt to create another route url with only filter1 present i.e. <%=Url.R...

.Net MVC Routing Catchall not working

I can't seem to figure this out. I'm experimenting with MVC Beta and am trying to implement a catchall route such that if the user enters mysite.com/blah instead of mysite.com/home/index it will hit the "Error" route. Unfortunately it seems that the "Default" route always catches "blah" first. In fact the only route I've been able to g...

File path as MVC route argument.

Part of my application maps resources stored in a number of locations onto web URLs like this: http://servername/files/path/to/my/resource/ The resources location is modelled after file paths and as a result there can be an unlimited level of nesting. Is it possible to construct an MVC route that matches this so that I get the path in...

undefined method rails question

Hello, I'm new to ruby and started to create my *nd toy app. I: Created controller 'questions' Created model 'question' Created controller action 'new' Added 'New.html.erb' file in erb file I use form_for helper and and new controller action where I instantiate @question instance variable. When I try to run this I get 'undefined met...

ASP.NET MVC: How to Route Search Term with . (Period) at the end

I get a 404 response from .Net MVC when I try to make a request where my search term ends with a . (period). This is the route that I'm using: routes.MapRoute( "Json", "Remote.mvc/{action}/{searchTerm}/{count}", new { controller="Remote", count=10} ); The search works fine wi...

rails routing controller action change

Hello, rails friends. I'm struggling here with a problem: I have a controller questions which has action new. Whenever I need to create new question, I'm typing /questions/new What changes to routes.rb should I make to change the URI to /questions/ask Thank you. Valve. ...