Route to subdomain - asp.net-mvc

I have made an asp.net mvc 3 application with an area called blog. I want to route this area to my subdomain blog.mywebsite.com. How can I achieve this?
How do I need to define my route?
Do I have to configure the DNS?
Currently I just use the default area route.
I can access my blog area for now at this way.
mywebsite.com/blog

You will require a CNAME entry setting up that will redirect to your website. Your hosting provider will be able to help out here if you are not familiar with this.

Related

domain specific ASP.NET MVC5 route with IIS rewrite

I have an MVC5 web application which maps to a domain www.example.com. I'm using basic {area}/{controller}/{action} based routing in my webapp and would need to map a subdomain to a specific route.
For example:
subdomain.example.com needs to always server content from http://example.com/area/controller/action
Ofcourse the route has to work with ASP.NET MVC5 routing and also all query parameters and "hashbang" data need to be retained so that:
http://subdomain.example.com#/somethinghere?var=value redirects content from http://example.com/area/controller/action#/somethinghere?var=value
So the question is: is this achievable with IIS routing/rewriting and if so, how? Another option would be to write custom MVC5 route which binds to a domain and I would love to see someone point me to a right direction with that, too.
This will not be possible, anything after the hash is client side only and the browser will not send it back to the server. As it is not send to the server there is no way to rewrite it.
As an alternative you can consider changing your routing to use pushstate instead of hashstate

Can a subdomain website create more subdomains on the same parent domain?

I am creating a rails website which needs the ability to create subdomains, however, the admin panel which can create these subdomains needs to also be located on its own subdomain so that the parent domain is separate.
Is it possible to create subdomains from a website already on a subdomain?
Sorry if it's hard to understand, I struggled to explain it.
Thanks.
Actually you can have just one application responding to how many domains you want. Just need to user proxy_pass if you are using nginx
Check this: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

IIS URL Rewrite based on logged in user

I have a scenario whereby I want to route http requests from authenticated users to specific websites hidden behind a reverse proxy. The decision of which site to route too is based on the specific user. For example, user 'Mary' may be routed to site "b"; user 'John' may be routed to site "e".
I am hosting the sites on IIS and am using ARR as my reverse proxy. I'm trying to figure out the best way to use URL Rewrite to make the routing decision.
One idea I had was to build a custom URL Rewrite provider that decrypts the FormsAuthTicket (created by an ASP.NET MVC website) and makes the routing decision based on information in that cookie.
Can anyone provide some guidance on how I can solve this problem? Am I on the right path?

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?
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.
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

ASP.Net 4 routing and subdomains

I'm developing a site with ASP.Net 4 which uses routing extensively. it displays pages for each client depending on the route data.
http://localhost/abc/manage/posts/ redirect to posts page of abc client
http://localhost/adidas/manage/posts/ redirects to adidas page.
now i need to do this using the subdomain way like adidas.localhost.com. i searched through SOF and found few solutions using MVC.
URL Routing across multiple subdomains
I have added the required wildcard dns, host file changes etc. and i understand that i need to read the hostheader to to determine the client. my question is where do i have to do this check, as im using routing without MVC i don't use MVC controllers. i need to do with ASP.net 4 routing. can someone give me an idea on this ?

Resources