routing

ASP.NET MVC Routing for files with muliple sub-directories

I need to setup a file handler to route with multiple sub directories something like tihs; http://localhost/images/7/99/786936215595.jpg I tried putting this in the global.asax file; routes.Add( "ImageRoute", new Route("covers/{filepath}/{filename}", new ImageRouteHandler())); I am using the ImageHandler found in this Que...

Rails 2.3 Namespace and Nested Shallow Resources Prefix Issue

I've added two namespaces into my routes that split the public and admin areas respectively. The idea is that they share models but the views and controllers are different for each namespace. My admin namespace is /admin and my public namespace is just / So... map.namespace :admin, :path_prefix => "/admin", :name_prefix => "admin_" do...

Zend Framework: Checking if route exists from code

in zend framework, is there anyway i can check if a route exists from code? example say the following routes/urls are valid (point to controller/action) /users /users/1 // /users?id=1 /users/page/1 /users?page=1 /users/tagged/tagname/page/1 /users?tagged=1&page=1 if the user tries to goto /users/nonexistantpage it should fail. soe...

Zend Framework routes not being applied

I have the following routes in my application.ini: resources.router.routes.user.route = "users/:id/*" resources.router.routes.user.defaults.controller = users resources.router.routes.user.defaults.action = profile resources.router.routes.user.reqs.id = "\d+" resources.router.routes.page.route = "pages/:date/*" resources.router.routes.p...

ASP.NET 4.0 URL Routing HTTP Error 404.0 - Not Found

hi i have implemented URL routing in asp.net 4.0 using following route. routes.MapPageRoute( "NewsDetails", // Route name "news/{i}/{*n}", // Route URL "~/newsdetails.aspx" // Web page to handle route ); which gives me url like http://www.mysie.com/news/1/this-is-test-news Which is...

ASP.NET MVC Routing, Need help creating route

My current Routing rules are routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); routes.MapRoute( "Admin", // Route name "Ad...

Rails 3 routing - passing params from routes.rb

In rails 2.3.5 you could do something like this inside the routes.rb file: map.root :controller => "pages", :action => "show", :id => 3 In rails 3 I haven't found any way to pass a specific parameter (like in rails 2.3.5 with :id => 3). I know I can handle it from the controller and have the same result (which I did), but I was wond...

ASP.NET MVC routing and file path

I have a controller action that has the same name as a file path. Like: www.example.com/userfiles/path/to/userfile.jpg Basically I have a userfiles controller and on the index action everything after userfiles/ is a path. There is also a userfiles virtual directory in the root of my application. What I want to happen is that if the di...

Twitter-like routes in ASP.NET MVC 2 application

I'd like to have routes set up as follows: "xyz/" maps to one action method with no parameters, but "xyz/{username}" maps to a different action (in the same controller or not, doesn't matter) that takes an argument called username of type string. Here are my routes so far: routes.MapRoute( "Me", "Profile", new { controller ...

What is wrong with this attempt to create a route to delete a record in RoR?

I have a model called NoteCategory, which is functioning as a join table between Notes and Categories. Up till this point, I have used scaffolding to do everything in RoR. I'm trying to learn how to do some stuff more manually. I want to have a link that will appear next to each category on a note, that will remove the category from t...

ASP.net MVC custom route

hi,guy, i have a page in my asp.net mvc website. the Route configuration: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{index}", // URL with parameters ...

How to get RouteData by URL?

I need to get RoutData by given URL string in ASP.NET MVC application. I've found the way that I need to mock HttpContextBase based on my URL string and then pass it to RouteTable.Routes.GetRouteData() method in Route Parsing (Uri to Route) thread. How to mock HttpContextBase to retrieve RouteData by URL string using RouteTable.Routes....

Windows server 2008R2 routing with single NIC

Hello, I'm trying to duplicate a Linux server configuration to a windows server 2008R2 box. Basicaly this linux server acts as a router, but it is doing its job with only 1 interface (1 NIC). Here is the network configuration in place (I cannot change it) : INTERNET <==> Router (local ip = 194.168.0.3) <==> linux Server (ip : 194.168....

URL Routing not working when set as Virtual directory under IIS.But works in VS IDE

I have an ASP.NET web application(WebForms,Not MVC) developed in VS 2008 and i have implemented ASP.NET web forms URL routing by following this link http://www.4guysfromrolla.com/articles/051309-1.aspx#postadlink It works pretty good when i run it on the Visual studion IDE.But does not works when i created a site under my IIS (IIS 5.1 i...

ASP.NET 4 Routing catch all

I have an ASP.NET 4 WebForms application which is using routing. I would like to catch the 404's for routes that do not exist: RouteTable.Routes.MapPageRoute("404", "{*url}", "~/error"); Problem is, this will also cause a mapping to /error for pages like ImageHandler.ashx and Resource.axd. So I add this: RouteTable.Routes.Ig...

How to match all .sass request to a particular controller in pylons?

I'm using pylons, and want to use clever css. I created a controller SassController to handle .sass requests, but in the config/routing.py, I don't know how to write the mapping. What I want is: client request: http://localhost:5000/stylesheets/questions/index.sass all such requests will be handled by SassController#index I tried: ...

ASP.NET 4 Routing querystrings problems

I have an ASP.NET 4 WebForms Web Application which is using Routing. I have URL's like this: http://website.com/product/123/name To use querystrings I made this route: product/{pid}/{name}/{*queryvalues} And I thought, instead of using normal querystrings like ?queryitem=value&item2=value2 I made this: http://website.com/product/1...

Routing problem with - in varaible

I have a rute in my asp.net mvc 2 site that looks like this routes.MapRoute( "media_display", "Media/{mediaId}-{mediaName}", new { controller = "Media", action = "Display" }, new { mediaId = @"\d+" } ); Where mediaId is the id, and mediaName is the title of th...

ASP.NET Routing - Route Constraint with database lookup

I'm just starting out with C# and ASP.NET and have the following questions. I am working with code adapted from a couple different tutorials playing with Northwind and have gotten this far. The list of acceptable categories is currently hard coded in a string but I would like to look up the CategoryName in the database to verify that i...

MVC2 Routing with WCF ServiceRoute: Html.ActionLink rendering incorrect links!

I have a WCF service that lives side-by-side with an MVC2 web site. I'd like for my URL for the service to look like this: http://localhost/projdir/Service The MVC site is in its infancy so it still has all its boilerplate controllers etc. The following code works at first glance in global.asax: public static void RegisterRoutes(Ro...