My domain is WWW.Bank.com which is configured to Bank folder.
I want to access same folder by demo.Bank.com/user.Bank.com/anything.Bank.com i.e I don't want to create new sub folder in my root.
If I give URL like demo.Bank.com then internal pages should be demo.Bank.com/folder 1/home.asp x likewise..
Please help. If anyone have any dummy code then please share.
This goes beyond ASP.NET in the core of the DNS.
You need to have control of the DNS zone of your 'bank.com' domain. If your DNS provider has a web-service for adding, deleting and updating DNS A and CNAME records, you could do that, but that's very unusual thing to do. Then again, you need to bind each domain name in the IIS website if you do not have a dedicated IP for such purposes.
Blogging websites are a good example for this, they usually host blogs on blogname.blogsite.com, such as alice.blogsite.com or bob.blogsite.com and as they usually have huge amount of different blogs, they resort to a single DNS record to take care of all of them.
That's called wildcard DNS and is what you need. Add one DNS record called *.yourdomain.com and point it to a dedicated IP address. That will work for any subdomain name combination, even the ones you don't want and where no content will exist (you're still going to be able to handle 404's). Then, on the server, add that IP address as a secondary network address. In the IIS bind your website to that IP address without Host Header (domain name) constraint, so it would receive all requests for that IP, regardless of domain name.
Finally, in your ASP.net code fetch Request.Url.Host and you're going to get your subdomain as it was typed by the user.
(You can also go with a single IP address, but then no other websites must exist on the server.)
Related
I have implemented a "User Registration" functionality using "CreateUserWizard" control in ASP.NET C#. When user is registered successfully, he receives an email. I used template file which reflects username and password along with redirected URL. As below:
http://myinternaldomain.xyz.com?changepassword.aspx?uname=abc&pwd=blahblah
Now, my issue is - the application should be accessible from outside domain firewall too. and external URL is something like http://myexternaldomain.xyz.com?changepassword.aspx?uname=abc&pwd=blahblah
Now, I have one template file and two URLs.
I am trying to develop a workaround to create another template file containing my external domain URL. But as of now there is no luck.
Can anybody advise is there any way to provide such template file so that both users (either internal or external) will get to see email with the respective URL?
Anyway you need one "universal" domain, because even if you can detect if current request was local or remote (outside domain firewall) and use one of two your templates later your url will be incorrect if user will change his/her location. So I would use myexternaldomain.xyz.com and just resolve it to your local webserver IP from your local network. If you have domain firewall then you probably have local DNS server. Or maybe there is way you can setup firewall rule so your traffic for myexternaldomain.xyz.com will be transferred to your local server, I'm not sure. Both tasks are administration-related though.
I've developed a RestService through C# that gets the petition in this way:
{server}/user/{action}
{server}/auth/{action}
...
I don't want people to access directly to the webservice, instead it's just the web server who has to access. I have successfully achieved this denying every IP except the webserver, but I realized now that there's a part of the site that should actually have public access.
EDIT: What I've done to deny every petition is the use of the feature "IPv4 Address and Domain Restrictions" from IIS, denying access to unspecified clients in the settings and finally adding just one allow entry to the ip I of the web server
So, what I want is to keep the actual behaviour, except for the case of pages like:
{server}/admin/{action}
How can I achieve this?
Thanks!
I want to develop sub domain feature using ASP.NET to work like how it happens here
when you sign up
you create a user name say "ann"
on sign up on "www.domainName.com"
you will get a subdomain "www.ann.domainName.com"
This approach will solve the issue
First, establish a wildcard DNS domain (*) for your site's IP address. That will allow anystring.yourdomain.com to resolve correctly.
Configure IIS to bind to a dedicated IP address, but not to rely on host headers (have an empty host header). That will cause all HTTP requests for the bound IP to be directed to your site.
Have an HttpModule that looks at the incoming domain (in HttpContext), and rejects it if it's not valid. You might consider setting a cookie or ticket or something like that, to avoid the need to do a DB lookup for each request in order to validate it.
Forms authentication doesnt work when a fully qualified domain name is used
localhost works
computername works
computername.fullyqualify.com does not work.
IP address works.
It ends up going in a loop between redirecting between the login and the main page.
It is almost as though the cookie is not being written.
Is there an IIS or active directory setting that I need to change here?
It is DNS' job to resolve FQDNs to IPs. From IIS you specify what IP to use, from a pool of IPs assigned to your Web Server, with which site amongt many hosted on your Web Server.
Check if you have correct Canonical Name record (CNAME) entries in you AD for the desired IPs.
Also ensure that it's replicated to all DNS servers if you have load balancing in AD.
If I have a generic public asp.net website, I want to know who is visting my website (I know how to get that), but more importantly, I want to know what company the user is from (is this a microsoft employee viewing my website, or a Coca Cola employee viewing my site or is this person using a home computer to view my site). How can I determine the computers domain name? Hope this is making sense.
Update: At most companies, I have seen the company name included as the "Full Computer Name" or the Domain value in "Computer name, domain and workgroup settings". Thats what I am looking to access.
You cannot do this with any absolute certainty - it suffers from a similar issue to getting their computer name, although you may have some success.
What you can try, is to do a reverse lookup on the IP address and take the domain part of the address (see previous link for code sample).
However, especially for smaller companies, this may just resolve to an ISP's domain, or perhaps not resolve at all. For home users it will almost certainly just be the ISP.
The other thing you could try, is to do a WHOIS on the IP address. This may give you an indication of the company; again, for smaller companies this is more likely to just be an ISP.
You can use Request.ServerVariables("remote_addr") to find the ip address that is being passed to you from the client and then use it to find out where it's coming from. A word of warning though, ip addresses can be spoofed, plus you may just be getting the address of a proxy server, so these things aren't exact.
After you get the ip address you'll need to do a whois lookup to find out who it's from. You may want to look here to find a whois api.
Also you may just consider running some sort of web log analysis through webtrends or some other analysis tool to get the same information in batch form. Because all of this information is more than likely being stored in your web server logs.
You cannot access computer name / domain name credentials without the user actually logging on to your public website with those credentials. If that were the case, you could access the remotely logged-on user using:
Request.ServerVariables["REMOTE_USER"]
The only way to get close to what you are asking is to use third party software. Maxmind.com is just one company that has a Geo location service. You can see that they offer an organisation field in their IP-to-City lookup.
If a user accesses your website from within a corporate network, Maxmind should have that data as part of their database, which you can then use.
Remember that the organisation refers to the IP address (netblock) owner. Therefore, should the user access your website from home, or from a mobile device, or anywhere outside the corporate network (or Maxmind has incorrect or incomplete data), then the data would be missing, misleading or flat wrong. The organisation needs to be big enough to own and register its own IP address block.
This info may also be available in Google Analytics.