I need to serve any of my subdomains
sub1.foo.com
sub2.foo.com
anysub.foo.com
from foo.com
I have successfully added a A record with the * value in WebsitePanel.
Should i make an edit at web.config in my project to enable this feature also?
If i visit for example anysub.foo.com i get the error message
The connection to anysub.foo.com was interrupted.
which i suppose means that something is blocking the response.
How can i fix that? Should i edit the web.config somehow or what?
UPDATE
The site hosted in a shared hosting environment
Unfortunately, it is not possible to bind wildcard hosts with IIS on a shared hosting environment. You need to have a dedicated machine with a dedicated IP that handles all incoming traffic, without being bound to a specific domain (i.e. default IIS website handling all incoming traffic).
AFAIK, this feature is not supported in IIS even in version 8.5.
On the DNS side, make sure it's set as a CNAME * pointing to #.
If your website is hosted at WebsitePanel you probably need to use the "Add Web Site Pointer" to make the A record know which Website to use.
(You might also need to remove the previously created A record.)
Related
I have a password reset email going out to users which uses Request.ServerVariables("SERVER_NAME") to generate a URL for the password reset page. Problem is, the URL of the web application was changed recently, and the old name is still being reflected in the SERVER_NAME server variable. How can I reset this so the new, current server name is used? I'd rather not restart the web app in IIS if I don't have to. (I haven't actually stepped through the code; if I'm understanding this correctly, it will work just fine locally because IIS gets refreshed a lot more frequently on my PC than it does on a production web server.) Or am I misunderstanding how server variables work?
In essence from my reading around, your SERVER_NAME may be the name of the windows server itself and not necessarily the DNS name the rest of the world uses to reach that server. HTTP_HOST might be a better bet because it is the contents of the Host http header, which came from what the user typed into their address bar and subsequently what the user's browser passed in order to gain access to the site.
This is particularly helpful for sites that are multi homed, by which I mean one set of code runs eg two websites with different branding/styling, different bindings in IIS (different dns names) but the same underlying code, repeating back to the user what they typed into the browser means they always think they are interacting with the same site
I have 2 apps, both live, one of them lets say webapp1 uses webapp2 to authenticate user, during that process it posts to a url from webapp2 passing some query parameters as well. recently there are some issues started appearing which can only be replicated in production as the webapp1 only has production instance, so to replicate this issue in local, i need to do something in my dev machine so that when i open webapp1 prod url in my machine, and it redirects to webapp2 prod url to login, it shall actually redirect to same replica of webapp2 in my localhost, IIS 7.5 hosted.
Details:
both are web applications, their domain setup like this in prod:
webapp1: https://webapp1.example.com/abc/xyz
webapp2 url: https://www.example.com/webapp2/login.aspx?abc=sometext&State=somestatetext
Now when i open webapp1's production url in my local, and it does post to webapp2's prod url, posting some data to it along with some query parameters, then i want that to rather redirect posting same data and passing same params to local instance of webapp2 running in my local machine,
for example to this:
https://localhost/webapp2/login.aspx?abc=sometext&State=somestatetext
Is there any way to achieve this without changing anything in webapp1 or 2 in production?
I feel it doesn't matter much but still webapp2 is aps.net web form app and my local machine is windows 7.
Tried few options but not sure they are right approach:
modify host file
modify host file to point example.com to localhost: but as both webapp1 and 2 are in same domain in prod, so i can't access prod url of webapp1 in my local machine, as that tries to open from my local, which i don't want to happen as i need webapp1 prod url to start request to my local.
trying this chrome extension:
https://chrome.google.com/webstore/detail/switcheroo-redirector/cnmciclhnghalnpfhhleggldniplelbg?hl=en
it looks promising but not sure if that does same what i am expecting/need, means can it mimic exact same post to localhost and pass all params as is?
anyone has any prior experience with this?
Just to share if someone else ends up with same/similar needs.
I ended up using this extension, its pretty useful and helps to redirect request to one domain to another paired domain. Beauty is you need not do anything in hosts file or anywhere else to get it working.
With it, i could map my prod/stage/test to my local dev and have them all saved for future usage and per need i can decide which pair i want browser to use for given testing.
https://chrome.google.com/webstore/detail/switcheroo-redirector/cnmciclhnghalnpfhhleggldniplelbg
I have my production site's app pool to recycle every 2 hours or so. I noticed that when the first call to the site is made, the App Pool caches the base url (e.g. www.mysite.com). This makes sense as this is used to resolve relative paths in ASP.NET e.g. ~/MyFolder/MyPage.aspx, which is resolved to:
http://www.mysite.com/MyFolder/MyPage.aspx
However since the site can be reached via our host name e.g.
http://masdfg.my.provider.net
IIS thinks the url is
http://masdfg.my.provider.net/MyFolder/MyPage.aspx
As you can image, this causing an issue with SSL as well as others. How can I prevent this from happening?
UPDATE: The work around was to create a url redirect. If anyone knows how to prevent this let me know.
I hope I've understood your question correctly, but please do let me know if I haven't.
It sounds like the sole issue you have is that when you write the links to the response they sometimes reference the wrong root URL.
I notice that you use ~/ . This would resolve and write the entire URL to the response I think. It is better to use only / when writing links to the response.
So in your example you would write /myfolder/mypage.aspx. The browser would then resolve the / to mean that it's from the root address of the site, whichever that may be.
Like I said, I hope I've understood your question correctly and apologies if I haven't.
I know it's a long shot, but I've had a similar problem with my IIS setup. I solved it by going to the already mentioned "bindings" window through "Edit Bindings".
Then I removed all the not wanted bindings, then adding the hostname www.mydomain.com the server should answer to.
Finally I edited the windows hosts file at
%windir%\System32\drivers\etc\hosts
Adding the line
127.0.0.1 www.mydomain.com
This ensures that www.mydomain.com always resolves to the local computer.
After executing iisreset.exe as administrator my problem was over.
HttpContext.Current.Request.Url is not a cacheable item. That value comes from the HOST value of the HTTP headers. Which means it is passed in to the application from the request.
The only time it should take that second URL is if the requests HOST value was masdfg.my.provider.net
There are three possible fixes here. The first is to set your bindings and have any requests to masdfg.my.provider.net be forwarded over to www.mysite.com
The second, because your primary issue appears to be about SSL is to get a unified communications (UC) SSL certificate and install that on your server. This would be to cover the mysite.com and masdfg.my.provider.net domain names.
The third is to simply create a separate IIS site which points to the exact same production directory as the first one. Each site would have only 1 domain name it's responsible for.
I have a business requirement, where i should show a different URL in the address bar from the actual. Say for ex: I have hosted my site at Hum.com. But for some users, this URL should show up as CP.com at the address bar? Is it even possible?
The only way to do this is if you control both domains, hum.com and cp.com and if you configure your web server to serve the same application for cp.com and hum.com.
If above is the case (you control both domains), you can simply redirect the users to the appropriate domain using Response.Redirect.
This is easily done in Apache via NameVirtualHosts and I am sure IIS offers the same functionality.
Yes this is possible, but it's generally done at the DNS level and not within the application itself. You want the IP address of Hum.com to resolve to the same IP address as CP.com. This is how hosting sites such as Google Sites generally work.
To do this you need to own the DNS entry for your vanity domain name (i.e. CP.com) and you need to ensure that the hosting site is capable of associating requests for CP.com with the hosted website.
This can be done by redirect.
if(fUserOfCP && !HttpContext.Current.Request.RawUrl.Contains("cp.com/")){
Responce.Redirect(
HttpContext.Current.Request.RawUrl.Replace("hum.com/", "cp.com/")
, true);
}
This code is the idea, probably is better to break the RawUrl, check and reconstruct it on the redirect to avoid the existing of host on file name.
Assume that both names belong to you, and you have setup correctly the dns.
Rewrite is not possible on host name if this is your first thoughts.
HI,
I have issue in using Windows live API
Iam using asp.net, am not able to use the callback url on local
The signin link is working only if i provide live url, but i cant able to use local host.
Please help
It may help someone else also -
Please add following entry in hosts file (located at [%system drive%]\Windows\System32\drivers\etc)
127.0.0.1 www.example.com
#[Please replace example domain with your actual one]
Windows live server expects your return url to have http:// in it but chrome does not add it and IE do add it, I realized this after wasting sometime.
This should get you through testing api on your local machine.
Go and setup a dynamic dns and a name for your computer and make your tests this way.
For example you can setup on DynDns.com a name for your dynamic ip, and then setup your router with that name to automatic assign it (or do it manual from the pages), and then you can use this name, and not the localhost. Do not forget to open the port to your router so the other side can make requests.
Also on /windows/system32/drivers/etc/host you can also setup the same name to see your local host and make your tests and callbacks.
Your problem is that the callback address needs to be the same as the address you used to sign up with.
(In relation to your callback), from the documentation:
The domain name portion of the URL (for example, www.contoso.com) must
be the same as the one that you specified when you created your
application with Live Connect. The URL must use URL escape codes, such
as %20 for spaces, %3A for colons, and %2F for forward slashes.
So, based on what you have said, you are using localhost (which you can't). As #Aristos suggested, add an entry to /windows/system32/drivers/etc/host to the domain you have registered (eg www.contoso.com).
Use www.contoso.com instead of localhost to test.