5

When a user registers with my site, they will get a url like this "http://username.mysite.com" to access their page/folder. How this is possible using C# and asp.net mvc.

Any help is appreciated.

2
  • What operating system / version of IIS are you hosting the site on? Commented Sep 17, 2009 at 7:44
  • Done all sork on subdomain in this.. link stackoverflow.com/questions/39145229/… Commented Sep 13, 2018 at 12:25

5 Answers 5

3

Rather than have the username as a subdomain how about having it as part of the URL path. Would be a lot easier for you to implement.

www.mysite.com/users/ravi
www.mysite.com/ravi

Then you could tailor your View page dependent on the username.

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

Comments

2

I was also looking to implementing your scenario and have some links bookmarked. Maybe this will get you on your way until some SO superstar gives another complete sample ;)

http://blogs.securancy.com/post/ASPNET-MVC-Subdomain-Routing.aspx (link down)

  • Step 1: Custom RouteBase
  • Step 2: Create the Controller
  • Step 3: Register the Routes
  • Step 4: Subdomains on localhost IIS

At the end of the article, it also references another SO post:

Is it possible to make an ASP.NET MVC route based on a subdomain?

It seems like a SO superstar has already answered the question :)

Comments

0

You might want to look into the IIS API over at MSDN.

Comments

0

I'd agree with @David (+1). Not only would it be easier to implement but it would be much more consistant for your site in regards to analytics, stats and probably most importantly, caching! There's probably several other reasons too!

Unless you want to treat each user as a client, which is different. But if they are all in the same domain then I'd advise to go with @David's suggestion.

Comments

0

You can also create fake subdomains with a custom HTTPModule as stated Here

Comments

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.