asp.net-routing

Url Routing Asp.net from hierarchical tree of pages stored in a database

Ok I have a bunch of html pages stored in a mssql database. Each row has: ID PageTitle Page Html Content ParentId ParentId is there so i can create a hierarchical tree of pages. Currently i am using this line of code in order to access the pages... routes.MapPageRoute("front", "{PageTitle}", "~/front.aspx"); Which then causes a ...

rewrite url. asp.net c#

how to rewrite url string. in asp.net with c#.net. ...

ASP routing vs relative links

I'm trying to implement routing on a simple site using web forms 3.5 SP1. The problem is that the site is using a simple form of CMS, so the user can create html content and add images. Since all the 'articles' in the database are stored with the image urls relative to the Default.aspx and my route is idCat/*categoryPath, all the images...

ASP.NET routing is messing up links

We added routing to an ASP.NET WebForms app. Routing is used to adds customer location information to the URL, so: www.example.com/orders/home.aspx would become www.example.com/california/orders/home.aspx. Customers can hit the page with or without the routing. We have a lot of relative URLs on the site - in the format "../folder/othe...

ASP.NET WebForms URLRouting - All Routes Receiving 404

All routes within my ASP.NET URL Routing web application are receiving a 404. However, the actual pages that exist are showing up correctly. I'm using IIS7. Any ideas? ...

ASP.NET MVC not using controller for explicit file route in IIS7

Consider a StaticResourceController that locates and serves files. I've set up an explicit route for "favicon.ico" that will handle the request for this file using StaticResourceController: routes.MapRoute( "favicon", "favicon.ico", new { controller = "StaticResource", action = "Get", file = "favicon.ico", area=...

Scrambling URLS for dynamic data

What is the best method to obfuscate the urls created in Dynamic Data? eg \Products\List.aspx?ProductId=2 could become \Products\List.aspx?x=UHJvZHVjdElkPTI= where "ProductId=2" is base 64 encoded to prevent casual snooping on \Products\List.aspx?ProductId=3 \Products\List.aspx?ProductId=4 etc...? I will probably have to inher...

Optional route parameters in ASP.NET 4 RTM no longer work as before

I upgraded my project to ASP.NET 4 RTM with ASP.NET MVC 2.0 RTM today. I was previously using ASP.NET 3.5 with ASP.NET MVC 2.0 RTM. Some of my routes don't work suddenly and I don't know why. I'm not sure if something changed between 3.5 and 4.0 - or if this was a regression type issue in the 4.0 RTM. (I never previously tested my app ...

How to use ASP.NET Routing in a Quote of the Day Website

Good Afternoon, A client is interested in creating an ASP.NET 2.0 website whose purpose is to serve up a "quote of the day". He wants the quotes on static content pages all attached to the same master page. The quote pages must be viewed in a certain sequence, and site browsers cannot view any other pages than the starting page when b...

How to route Url with # character in Asp.Net 4?

How to route url contains # sharp character like this: ~/page.aspx#/Home to be: ~/Home ...

ASP.NET MVC: Html.Actionlink() generates empty link.

Okay i'm experiencing some problems with the actionlink htmlhelper. I have some complicated routing as follows: routes.MapRoute("Groep_Dashboard_Route", // Route name "{EventName}/{GroupID}/Dashboard", // url with Paramters new {controller = "Group", action="Dashboard"}); ...

How to adjust asp.net URL routing based on domain/host?

What's the best way to adjust the path destination for a routing table created in the global.asax Application_Start event based on the domain/sub domain/host? The following worked in IIS6, but with IIS7 the request object is decoupled from the Application_Start event and therefore does not work anymore: Dim strHost As String = Context.R...

How to route tree-structured URLs with ASP.NET Routing?

Hello Everyone, I would like to achieve something very similar to this question, with some enhancements. There is an ASP.NET MVC web application. I have a tree of entities. For example, a Page class which has a property called Children, which is of type IList<Page>. (An instance of the Page class corresponds to a row in a database.) ...

GetRouteUrl returns null and RedirectToRoute throws "No matching route found for RedirectToRoute."

Page.GetRouteUrl("routename", new { blah = "blah" }) Returns null Response.RedirectToRoute("routename", new { blah = "blah" }) throws InvalidOperationException("No matching route found for RedirectToRoute.") I put a breakpoint and checked System.Web.Routing.RouteTable.Routes and my routes are there. I can use them without a hitch ...

How to create RouteUrls with databound parameters declaratively?

I'm using the new Routing feature in ASP.NET 4 (Web forms, not MVC). Now I have an asp:ListView which is bound to a datasource. One of the properties is a ClientID which I want to use to link from the ListView items to another page. In global.asax I have defined a route: System.Web.Routing.RouteTable.Routes.MapPageRoute("ClientRoute", ...

Does Security Trimming work with Web Forms Routing?

In my web.config I have configured a SiteMapProvider with securityTrimmingEnabled="true" and on my main master page is an asp:Menu control bound to an asp:SiteMapDataSource. In addition I have configured restricted access to all pages in a subfolder "Admin" (using another web.config in this subfolder). If I put a sitemapNode in Web.site...

ASP.NET MVC Route Default values

hi, i defined two routes in global.asax like below context.MapRoute("HomeRedirect", "", new { controller = "Home", action = "redirect" }); context.MapRoute("UrlResolver", "{culture}/some", ...

How to route lower-case URLs ('questions/add_to_favorites/123') with underscores in ASP.NET MVC2?

ASP.NET MVC 2 controllers and actions use UpperCamelCase. For some reasons many big sites, including SO, use lowercase (with underscore) for controllers and actions in the urls. Examples: http://stackoverflow.com/questions http://stackoverflow.com/users/377920/randomguy http://www.reddit.com/ad_inq/ http://www.wired.com/special_multime...

ASP.NET 4 Web forms Routing images

I'm using ASP.NET 4 Web forms routing, for example like this: routes.MapPageRoute("page-browse", "{Language}/{Label}", "~/Default.aspx") So the webadress could look like: http://localhost/mywebsite/eng/home In the root of my website I have a folder "Images". Image display works when I'm in the root of my website, e.g. by using http://l...

Cleaning up my ASP.NET URLs

I noticed that ASP.NET 4 has a new feature called 'Routing' or something similar. It apparently allows me to use cleaner looking URLs, which purportedly is both for looks and improved SEO. In my case use only basic URLs with little to no GET queries (ie. index.aspx, login.aspx, manage.aspx etc.) Would the ASP.NET routing be of use to me?...