Click here to Skip to main content
15,885,014 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This may seem like a pretty easy question but I would like to ask what does this condition says?


VB
if instr(LCase(Request.ServerVariables("HTTP_HOST")),"corpwebdev") > 0 or instr(LCase(Request.ServerVariables("HTTP_HOST")),"_train") > 0 then
        cnOracle.Open "PROVIDER=MSDAORA;DATA SOURCE=TestDB;USER ID=DBuser;PASSWORD=DBuser"
    else
        cnOracle.Open "PROVIDER=MSDAORA;DATA SOURCE=ProdDB;USER ID=DBuser;PASSWORD=DBuser"
    end if


The one that tricks me is the "if instr(LCase(Request.ServerVariables("HTTP_HOST")),"stluscorpwebdev") > 0 or instr(LCase(Request.ServerVariables("HTTP_HOST")),"_train") > 0" part.

Thank you in advance!
Posted
Updated 14-May-15 8:23am
v2

1 solution

If you google HTTP_HOST you'll see that it stores "the Internet host and port number of the resource being requested." http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23[^]

This code uses a different connection string (to a test vs production db it appears) depending on which server the code is running on.
 
Share this answer
 
Comments
serigraphie 14-May-15 14:43pm    
Thank you Ryan! We just migrated server, do I need to change the host? Can you help me go to the direction wherein I can find the internethost and port number ? Again, thank you so much!
ZurdoDev 14-May-15 15:08pm    
If the code works you can leave it alone otherwise, ya, you'll need to change it.

The internet host is what you type in to get to it. For example: www.microsoft.com is the host.
serigraphie 14-May-15 16:12pm    
Thanks again but unfortunately I need to make necessary changes because if not, it will fall to else condition which is our production database instead of development database. Now we don't want that hehe. Appreciate your help, I'll just do necessary changes.
ZurdoDev 14-May-15 16:23pm    
Yes, be very careful which db you are accessing. ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900