user1477388
user1477388

Reputation: 21440

Blogs as Sub Domains in ASP.Net MVC

My blog creates URLs like this:

http://localhost:55649/Blogs/MyBlog

How can I create a sub domain so that it looks like it's hosted on it's own subdomain, like this:

http://myBlog.localhost:55649/

I know I can create a sub domain to redirect to localhost:55649/Blogs/MyBlog, but I want that to be the actual domain. Is this possible?

Upvotes: 0

Views: 285

Answers (2)

Tommy
Tommy

Reputation: 39807

This is possible in MVC and has been answered before here on SO

See Previous Answer

In order for DNS to work, you will need to setup a wildcard subdomain so that any subdomain request for yourdomain.com will still point to your site. IIS will also need to be configured to listen for any and all request for any subdomain for your site. I cannot answer how to do this as I do not know your hosting configuration.

Upvotes: 1

STO
STO

Reputation: 10648

Probably it is not possible by ASP.NET MVC own possibilities like routing. You need to create two sites in IIS (one for domain and another for subdomain) pointed to the same directory with site code.

And surely it is not possible with ASP.NET Development Server.

Probably URL Rewrite module would also help you: http://www.iis.net/download/urlrewrite

Upvotes: 1

Related Questions