asp.net - Single domain to multiple redirects (Redirecting) -


will ask question example :-

so here go :)

i getting 100 visits day on www.mywebsite.com

i redirecting user anothter website.

so question can redirect random 50 website1.com , rest 50 website2.com

is possible ?

you can use application_beginrequest on global.asax check .aspx page make redirect ask

static int ccounter = 0;     protected void application_beginrequest(object sender, eventargs e) {     string sextentionofthisfile = system.io.path.getextension(httpcontext.current.request.path);     if (sextentionofthisfile.equals(".aspx", stringcomparison.invariantcultureignorecase))     {         httpapplication app = (httpapplication)sender;          if (++ccounter % 2 == 0)         {             app.response.redirect("http://site1.com", true);         }         else         {             app.response.redirect("http://site2.com", true);         }                    return;     } } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -