If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > hiding the database connection string

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-04, 15:18
atulkumar79 atulkumar79 is offline
Registered User
 
Join Date: Sep 2004
Posts: 1
hiding the database connection string

Hi,
I want to hide connection string to the database. Presently i have that hard coded in the asp page. But i want hide the connection string in registry or somewhere more secure.

Can anyone help me with the procedure how to do it and also the asp code as to how to access that connecitonstring.

thanks,
atul kumar.
Reply With Quote
  #2 (permalink)  
Old 09-17-04, 15:52
rsheppar rsheppar is offline
Registered User
 
Join Date: Sep 2004
Posts: 1
Hide connection string to database

You could use an include and put the connection string is a separate page.

<!--#include file="../connection/connect.asp"-->


connect.asp might look something like this if you are using a MS Access database:
<%
' this will create the connection to the database
dim MyConnection
set MYConnection = server.CreateObject("ADODB.Connection")
MyConnection.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=C:\pathtodatabase\Mydb.mdb"

MyConnection.Open
%>
Reply With Quote
  #3 (permalink)  
Old 09-18-04, 00:58
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
There is no way to completely hide the connection string. But if you want to hide the database server, username, and password, you should create a DSN on the server. Then all you have to do is put the DSN name in the connection string. On Windows 2000, it's under Start > Settings > Control Panel > Administrative Tools > Data Sources ODBC.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #4 (permalink)  
Old 09-22-04, 19:58
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
you can hide it int he registry but you would want/need to write a com object to get the value from the registry (atleast I'm not aware of any way to look at the registry using ASP). you could put it in a file and encrypt it but then you would need to have a decryption function as well which would (basically) be easily hacked so it probably wouldn't help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On