I am trying to use domain masking to simulate multi-tenant access to my application. The plan right now is to read the subdomain portion of the dom开发者_运维知识库ain ie: demo.mydomain.com and load settings from the DB using that name.
The issue I'm having is that request.url is getting the request url - NOT the url in the browser.
So if I have http://demo.mydomain.com forwarding to http://www.mydomain.com/controllername with masking, request.url is grabbing the latter, simply because of how masking works, i assume - by putting the masked site inside of a frame.
Is it even possible to read the url in the browsers address bar? Thanks.
You probably can get the url you want, but at the client side...
So, do this:
- Get the browser's url by using a javascript call, like
window.location.href
. - Post that url to the server-side.
Cons:
- This is a javascript dependent solution, it will not work with javascript disabled.
- This is ugly as hell.
Pros:
- You probably do not have any other option.
精彩评论