routing

Asp.Net MVC - Best approach for "dynamic" routing

I am trying to come up with an approach to create "dynamic" routing. What I mean, exactly, is that I want to be able to assign the controller and action of a route for each hit rather than having it mapped directly. For example, a route may look like this "path/{object}" and when that path is hit, a lookup is performed providing the app...

Three Layered Web Application

Is it OK - best practise wise - to use the second layer to redirect the user? For example: public static void ForceLogin() { HttpCookie cookie = HttpContext.Current.Request.Cookies[cookieName]; if (cookie != null) { if (Regex.IsMatch(cookie.Value, "^[0-9]+\\.[a-f0-9]+$")) { using (EibxDataContex...

ASP.NET Routing in WebForms - Blank Page Bug?

OK, I have a standard ASP.NET WebForms Application (3.5, SP1)... I've just added the System.Web.Routing DLL, and set a route to a point to a new handler. That handler is VERY VERY simple, and simply returns a new instance of a standard page. Code here: public class ReportRouteHandler : IRouteHandler { IHttpHandler IRouteHandler.Get...

ASP.NET Routing - Do Custom Routes COMPLETELY SKIP Everything in the Global.asax?

I have a simple ASP.NET 3.5 SP1 Web Forms app... I've added the System.Web.Routing DLL, and I've made a simple route that returns a standard ASP.NET Page as the "IHttpHandler". All is good... except that HttpContext.Current.User is null ??? So, I did a little more digging (I put breakpoints in all the events in the Global.asax file). N...

Django, Rails Routing...Point?

I'm a student of web development (and college), so my apologies if this comes off sounding naive and offensive, I certainly don't mean it that way. My experience has been with PHP and with a smallish project on the horizon (a glorified shift calendar) I hoped to learn one of the higher level frameworks to ease the code burden. So far, I...

Using Routing without MVC: authentication form

Hi. Now I'm trying to work with System.Web.Routing. All is just fine, but I can't understand how to make form authentication work with url routing (return url, redirection, etc). Google says nothing. Help! :) UPD: I forgot - I don't use MVC. That's the problem. How to use rounig and form authentication without MVC UPD2: more about my...

Rails friendly url routing with open id

I would like to use create a rails route for a user's open id. The url would look something like http://mysite.com/identity/:html_encoded_openid or http://mysite.com/identity/:html_encoded_openid.xml This would be so that the site could be queried for an open id and either view info for that identity or receive an xml document contai...

ASP.NET MVC page/subpage routing

Hello, I'm try to figure out how to handle the following scenario. In general, i have a bunch of records in a table. All of these have ID and ParentID fields to form a tree. Page1 - Page2 - Page3 Page4 - Page5 -- Page6 Now, i want my routes for Page3 and Page6 to be like /Page1/Page6 and /Page3/Page5/Page6 respectivelly. That is,...

ASP.Net MVC Html.ActionLink() problems

I'm using the MVC beta to write a simple application to understand ASP.Net MVC. The application is a simple photo/video sharing site with tagging. I'm working off the MVC skeleton project. I added some Html.ActionLink()'s to the navigation bar, but I'm having a problem with one of the Html.ActionLink()'s that I added in one spot. I wa...

MVC Routing - what number of routes will start to cause performance issues?

I am considering pre-loading routes to static content pages, allowing for n-depth nesting of content. I have a solution spiked that provides a bit of comfort in terms of the number of potential routes registered, but I'm wondering if I'm making the system overly complex. At what number of registered routes do you suspect a basic hosting...

"The resource cannot be found." error when there is a "dot" at the end of the url

Hi, I'm using ASP .NET MVC Beta and I get the HTTP 404 (The resource cannot be found) error when I use this url which has a "dot" at the end: http://localhost:81/Title/Edit/Code1. If I remove the dot at the end or the dot is somewhere in the middle I don't get the error. I tried to debug but it I get the error from "System.Web.Cached...

What algorithms compute directions from point A to point B on a map?

How do map providers (such as Google or Yahoo! Maps) suggest directions? I mean, they probably have real-world data in some form, certainly including distances but also perhaps things like driving speeds, presence of sidewalks, train schedules, etc. But suppose the data were in a simpler format, say a very large directed graph with edg...

asp.net mvc routing problem when passed parameter contains dot

Hi, I have very basic routing: routes.MapRoute( "Default", "{controller}/{action}/{id}",parameters new { controller = "Home", action = "Index", id = "" } ); The problem is that it works perfectly in all simple cases, like "www.xxx.yy/pages/filter/test". As soon as I add dot "."...

Rails: how do you access RESTful helpers?

I'm trying to work through this guide to Rails routing, but I got stuck in section 3.3: Creating a RESTful route will also make available a pile of helpers within your application and then they list some helpers like photos_url, photos_path, etc. My questions: Where can I find the complete list of helpers that is "made available?...

Why can't ASP.NET MVC URL routing find my controller?

In my Global.asax.cs file in RegisterRoutes method, I put routes.MapRoute("messages", "Message/{id}", new { controller = "Archive", action = "Message", id = 0 }); Then I created this controller: namespace TestingApp.Controllers { public class ArchiveController : Controller { public string Message(int id) ...

Best way for ASP.NET MVC routing for not-so common scenarios?

UPDATE - 1/21/09: The only way I've been able to get this working moderately well is to create routes that have additional path info... in other words instead of http://company.com/myDepartment/myTeam/action/id, the routes need to be built to handle paths like http://company.com/department/myDepartment/team/myTeam and so on. END UPD...

Moving MVC Beta Web application to Virtual Directory strips out all /Content resources

I have a very nice MVC Beta application developed using VS2008 on a win2008 server. My troubles began when I attempted to deploy it to an IIS6 virtual directory. After installing the MVC Beta on the target win2003 server box I was able to get the application to display from a virtual directory, but all images and css attributes are mis...

ASPNET MVC: Way to figure out the route of the referer (sic)?

I have some POST actions on my controller that are hit from a pair of GET actions. When validation fails, I want to render the view of the action that the POST is coming from. For example: ~/accounts POSTs to ~/accounts/disable - render "index" view on validation error ~/accounts/profile POSTs to ~/accounts/disable - render "profile" ...

ASP.NET MVC QueryString defaults overriding supplied values?

Using ASP.NET MVC Preview 5 (though this has also been tried with the Beta), it appears that querystring defaults in a route override the value that is passed in on the query string. A repro is to write a controller like this: public class TestController : Controller { public ActionResult Foo(int x) { Trace.WriteLine(x);...

Using a named route in Form.Begin in ASP.NET MVC

Is there a way to force use of a named route in ASP.NET MVC when using Form.Begin. I'm learning more and more about routing and getting scared that it can be very fragile if you just change the order or whether or not parameters have defaults. <% Form.Begin(...) %> <!-- no overload for providing a route name --%> There does not seem t...