Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection strings (again)

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
Hi,

I have been trying to find a way to hide the username and password of a connection string to a SQL Server database.

In the process, I have found myself utterly confused.

I have database connections within <%....%> tags (which I understood to be ASP) and within <SCRIPT language=&quot;vbscript&quot;>....</SCRIPT> tags (which I understood to be VBscript)

I have found that of all the ways I have tried (cookies, session variables, include files) they work with one or the other but never both.

Is there something I can use to store the values of the username and password entered and then include them in the string nomatter where the database connection is made?

It would be really handy if I could reference the session variable from within the <SCRIPT>....</SCRIPT> tags but that doesnt seem possible.

Thanks?
jan


 
Jan,

Post your values from a form to session variables and then build your connection string on the fly using those variables on whatever pages you need to.

Dave

 
Thanks for your reply.

Ive tried that. Unfortunately, I cant see the value of session variables in script within <SCRIPT language=&quot;VBscript&quot;>..</SCRIPT> tags. only <% %> tags. Should this be the case??
 
Yes, that is correct.

<% %> = Server side code, therefore you can use Session variables directly

<script language=&quot;VBScript&quot;>...</script> = client side code

You could do this to get the values of your Session variables into the client side code:

<script language=&quot;VBScript&quot;>
someVar = <%=Session(&quot;someVar&quot;)%>
</script>

But then the value in the Session variable will become visible in the source code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top