ASP.NET MVC - Wordpress Style URLs
صفحه اصلي

ASP.NET MVC - Wordpress Style URLs



Wordpress is very highly regarded and proven to follow good practise which in turn facilitates rankings with search engines.

One proven factor is the seo freindly urls. Such as the examples below;

www.myblog.com/test www.myblog.com/another www.myblog.com/contact 

Lets say that we have two controllers, each with their won actions;

View/BlogPost View/BlogCategory Contact/Form Contact/Post 

The wordpress view engine is flexible enough that the test url can resolve to BlogPost and the another url can resolve to BlogCategory.

Does anyone know if this is possible in MVC and is it feasible? Im thinking about a custom 404 handler that would preserve the url in the browser and then fire the required actions.


fluent Nhibernatetest mappings

1:

would i need antixss for report printing
You define a route in the global.asax like this, the bottom one being the default:. using MultiSelectList in ASP.NET MVC
        routes.MapRoute(             "Test",             "test",             new { controller = "View", action = "BlogPost"}         );          routes.MapRoute(             "Another",             "another",             new { controller = "View", action = "BlogCategory"}         );          routes.MapRoute(             "Default", // Route name             "{controller}/{action}/{id}", // URL with parameters             new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults         ); 
The second parameter in MapRoute() is the URL, in your case "test" and "another". ASP.NET MVC Form Submit with Link instead of ButtonYou must probably see here, this you must store this route data any where else, like a db, then foreach through them adding each one to the RouteCollection.. Using jquery to generate a Slug from Title (on lost focus)
Is it possible to load content dynamically through ajax (instead of upfront) in simile timelineError when Saving into SQL Server

2:

ASP.NET MVC iframe load
You could add an Action to your controller, with a RedirectToAction() call.
... public ActionResult test() {     return RedirectToAction("BlogPost"); } .. public ActionResult another() {     return RedirectToAction("BlogCategory"); } ... 

3:

As another guys answered above it's easy to have such routes to have friendly "Slug" URLs. There are also any tricks to build pretty clean URLs like WordPress. I have written two blog posts on this topic which may guidance you have a better understanding of Slug URLs: Build pretty clean URL for your dynamic pages using JavaScript and Translating your content title using Google Translate API to use in a URL.


47 out of 100 based on 47 user ratings 727 reviews

^