Salakhetdinov Shamil
mcp2004 at mail.ru
Sun Sep 30 14:32:27 CDT 2012
Thank you, Gustav, But that was you who did it again, wasn't you? ;) -- Shamil Sat, 29 Sep 2012 17:36:15 +0200 от "Gustav Brock" <Gustav at cactus.dk>: > > > > >Hi Shamil > > You did it again! This is, of course, how to do it, but what did I know as little as I have worked with ASP.NET. > The server runs ASP.NET 4.5, so System.Web.Routing it is extremely easy to configure in Global.asax at Application_Start: > > protected void Application_Start(object sender, EventArgs e) > { > RegisterRoutes(RouteTable.Routes); > } > > void RegisterRoutes(RouteCollection routes) > { > // Register a route to handle all urls. > // The {*...} instructs the route to match all content after the first slash." > routes.MapPageRoute( > "CatchAll", // Route name > "{*MyKeys}", // Route URL > "~/Default.aspx" // Web page to handle route > ); > } > > Thanks for the head up! > > /gustav > > PS: Here is a brief, though good tutorial: http://www.4guysfromrolla.com/articles/012710-1.aspx > > >>> Salakhetdinov Shamil <mcp2004 at mail.ru> 26-09-12 23:16 >>> > Hi Gustav -- > > Just a note (I have no real life experience with cases as you have) - do you have ASP.NET routing enabled for your "human-friendly" URLs - the ones without .aspx extension? > >http://stackoverflow.com/questions/3523264/asp-net-4-0-url-routing-http-error-404-0-not-found > > > Thank you. > > -- Shamil > > > Wed, 26 Sep 2012 22:55:40 +0200 от "Gustav Brock" <Gustav at cactus.dk>: > > > > > > > > > > > > > > >Hi all > > > > > OK, I've made some progress - paying attention to Upper/lower case of Mode: > > > > > <configuration> > > > ****<system.web> > > > ******<compilation debug="true" targetFramework="4.5" /> > > > ******<httpRuntime targetFramework="4.5" /> > > > ******<customErrors mode="On"> > > > ********<error statusCode="404" redirect="Default.aspx" /> > > > ******</customErrors> > > > ****</system.web> > > > </configuration> > > > > > Now a not-found page like: > > > >www.example.com/somewrongpage.aspx > > > > > is redirected. But: > > > >www.example.com/somethingwrong > > > > > still fails with 404. > > > > > Any hints? > > > > > /gustav > > > > > > > >>> gustav at cactus.dk 26-09-12 17:43 >>> > > > Hi all > > > > > I have an extremely simple site, one page only: Default.aspx > > > > > How can I in a simple way redirect all faulty URLs to this page? So that if the user types: > > > >www.example.com/somethingwrong > > > > > the error is trapped and the user gets: > > > >www.example.com/Default.aspx > > > > > I have this Web.config file which should do the job, but it doesn't: > > > > > <configuration> > > > ****<system.web> > > > ******<compilation debug="true" targetFramework="4.5" /> > > > ******<httpRuntime targetFramework="4.5" /> > > > ******<customErrors Mode="On"> > > > ********<error statusCode="404" redirect="Default.aspx" /> > > > ******</customErrors> > > > ****</system.web> > > > </configuration> > > > > > Aside from this I can google many fancy solutions. Not needed. It just needs to call the default page. > > > > > /gustav > > > _______________________________________________ > dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > >