0

If you see the yahoo site, when you enter www.yahoo.com, the yahoo server gets your IP, and redirects you to the specific domain (yahoo.ca,yahoo.us,....)

Now, I want do this,Not for special site, I want to get any request send to iis (www.1.com,www.2.com,www.3.com) and with the algorithm, redirect user to the new site for example:

 Request: www.1.com GO To -> www.yahoo.com
 Request: www.2.com GO To -> www.google.com
 ....

I want handle IIS, no each webconfig's site.

Can anybody help me?

bahman
  • 1
  • 1

2 Answers2

2

implementing the IHttpModule you can do this, I've done the similar (not exactly) by following this guide:

http://www.stardeveloper.com/articles/http-module-to-redirect-requests-from-root-domain-to-www-subdomain/

and using this page you can find the source country of the request

another solution in this page

Community
  • 1
  • 1
Afshin
  • 1,222
  • 11
  • 29
  • Thanks Jadarnel,this is my first question. – bahman Jan 12 '12 at 20:58
  • But this link is usefull when You want to impelement for one website,but i want to do it for all the websites ,are on the severe. I need to handle http module in iis level ,no application. – bahman Jan 12 '12 at 21:01
  • I'm not quite sure how to do that, but using the above guide, you can add the module as a standalone dll to every web application where ever they are, btw you need to publish your site on those servers, don't you? – Afshin Jan 12 '12 at 21:06
  • Yes.i Need to handle hhtpmodule on IIS ,not each webSites. – bahman Jan 12 '12 at 21:27
  • +1 for the interesting link for the stardeveloper setup. The OP could adopt this route for free :-) with the downsides being the need to install, invoke and manage the module in each app, as well as carefully configure their domain setup. – dash Jan 12 '12 at 21:51
  • Thanks dash, yes it's a quite interesting article. glad you liked it. – Afshin Jan 12 '12 at 21:56
1

In addition to Afshin's answer versus discovering a user's geographical location also look at this.

Unfortunately, a HTTP Module only works at the web site level; to do what you need you have to look at ISAPI_Filters.

See http://msdn.microsoft.com/en-us/library/ms972974.aspx for more information.

We ended up buying a product linked from that page; ISAPI Rewrite

dash
  • 89,546
  • 4
  • 51
  • 71
  • honesty, is installing an ISAPI easier than httpmodule? knowing the fact that you need to install the web application though... – Afshin Jan 12 '12 at 21:37
  • 1
    It's easier to manage with the ISAPI filter as it's server wide. However, you could potentially do it with individual ASP.Net apps but you'd be increasing the load on each additional app, would have to manage the module in each app, and would also have to do it in each subdomain you created. – dash Jan 12 '12 at 21:41
  • I notice that ISAPI Rewrite offer a LITE version. It may be worth looking at the documentation for that. – dash Jan 12 '12 at 21:46