Thursday, March 22, 2012

OleDbConnection

Hi,

I am just developing my first web application using asp.net and vb.net.

So far I have created a logon screen (which is a web form) where the user enters name and password and an OleDBConnection gets established. This works fine.

The question is now, how can I pass this connection the next page (web form). Do I have to use the session object or is there another mechanism I can use for this?

An example would be helpful.

Thanks in advance,
WolfgangKeeping connection string in Web.Config would be a better idea, probably encrypted and while using time you can decrypt or in Global.asax, you can call it and decrypt and keep in applicaiton variable and use it using Applicaiton variable where ever you need!

Ex: of web.config usage
http://aspnet.4guysfromrolla.com/articles/053102-1.aspx
Thanks for the quick reply and the example.

There are 2 problems I can see with this approach:

1. I am developing a multi-user application. When I keep the connectstring in Web.config, this is an application wide variable. At least username and password, which is part of the connect string, is not application specific, but user (session) specific. I cannot allow all my users to connect with the same username/password to the database. Any solution for that?

2. Keeping the connect string in Web.config would be fine, but would mean, that for each page a new database connection has to be established calling the open method. This takes time and if possible, I would like to avoid this.

regards,
Wolfgang

0 comments:

Post a Comment