1

I have a requirement like my controller name will be coming from database like below

http://www.mysite.com/ParkName

I'm using ASP.Net mvc3

I'm not getting any perfect solution how to route that dynamic controller or do in better way.

Could any one please Guide me.

2
  • You should have a look a the ASP.NET Dynamic Data Entity Web Application. This MSDN link gives you a guide. Commented Oct 30, 2013 at 10:37
  • What i need is the {controller} portion of the url determined from my database column. How to handle that? When i click above url it should show appropriate park for the users. Commented Oct 30, 2013 at 10:48

1 Answer 1

1

You can override DefaultControllerFactory to search controller type base on database name.

There is a simple example on Code Project

Sign up to request clarification or add additional context in comments.

3 Comments

I created a Class called DynamicControllerFactory and wrote following public class DynamicControllerFactory : DefaultControllerFactory { private readonly IServiceLocator _Locator;
And? You still have problem?
Right now i can redirect to the action but it gives the issue when displaying view. It throws error like The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.