提示用户输入连接字符串 [英] Prompt user for connection string
问题描述
嗨。
我正在使用SQLDataSources,并在connectionStrings元素下的
web.config文件中使用硬编码的连接字符串。但是,我希望用户
能够在登录页面输入用户名和密码,我希望随后在连接字符串中使用
。这可能吗?
谢谢。
-
McGeeky
http://mcgeeky.blogspot.com
" McGeeky" < an ** @ anon.comwrote in message
news:e9 ************** @ TK2MSFTNGP04.phx.gbl ...
< blockquote class =post_quotes>
我正在使用SQLDataSources,连接字符串是在connectionStrings元素下的
web.config文件中硬编码的。但是,我希望用户
能够在我想要的登录页面上输入用户名和密码
到
随后在连接字符串。那可能吗?
是 - 将用户名和密码(加密,如果可能)存储在
会话变量中,然后只使用String.Replace
现有连接字符串上的()方法。
-
http://www.markrae.net
是的,你需要提供一些gui用于输入凭据,从用户输入中输出
连接字符串,并将其保存在会话变量
中,它将可用于所有其他页面。您可以考虑使用
登录控件。
-
Eliyahu Goldin,
软件开发者&顾问
Microsoft MVP [ASP.NET]
http: //msmvps.com/blogs/egoldin
http://usableasp.net
" McGeeky" < an ** @ anon.comwrote in message
news:e9 ************** @ TK2MSFTNGP04.phx.gbl ...
< blockquote class =post_quotes>
嗨。
我正在使用SQLDataSources,在
web.config文件下硬编码连接字符串connectionStrings元素。但是,我希望用户
能够在我想要的登录页面上输入用户名和密码
到
随后在连接字符串。这可能吗?
谢谢。
-
McGeeky
http://mcgeeky.blogspot.com
感谢Mark和Eliyahu。
当替换现有的连接字符串时,这仅适用于那个
用户的会话还是全球变化?
-
McGeeky
http://mcgeeky.blogspot.com
" Mark Rae" < ma ** @ markNOSPAMrae.netwrote in message
news:uw ************** @ TK2MSFTNGP04.phx.gbl ...
< blockquote class =post_quotes>
" McGeeky" < an ** @ anon.comwrote in message
news:e9 ************** @ TK2MSFTNGP04.phx.gbl ...
< blockquote class =post_quotes>
我正在使用SQLDataSources,连接字符串是在connectionStrings元素下的
web.config文件中硬编码的。但是,我想要
用户
to能够在登录页面输入我想要的用户名和密码
到
随后在连接字符串中使用。那可能吗?
是 - 将用户名和密码(加密,如果可能)存储在
会话变量中,然后只使用String.Replace
现有连接字符串上的()方法。
-
http://www.markrae.net
Hi.
I am using SQLDataSources with the connection string hardcoded in the
web.config file under the connectionStrings element. However, I want users
to be able to enter a username and password on a login page which I want to
subsequently use in the connection string. Is that possible?
Thanks.
--
McGeeky
http://mcgeeky.blogspot.com
"McGeeky" <an**@anon.comwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
I am using SQLDataSources with the connection string hardcoded in the
web.config file under the connectionStrings element. However, I want users
to be able to enter a username and password on a login page which I want
to
subsequently use in the connection string. Is that possible?Yes - store the username and password (encrypted, if possible) in the
Session variable, and then just use the String.Replace() method on the
existing connection string.
--
http://www.markrae.net
Yes, you need to provide some gui for entering the credentials, make the
connection string out of the user input and save it in a session variable
where it will be available for all other pages. You may consider using the
Login control.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"McGeeky" <an**@anon.comwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...Hi.
I am using SQLDataSources with the connection string hardcoded in the
web.config file under the connectionStrings element. However, I want users
to be able to enter a username and password on a login page which I want
to
subsequently use in the connection string. Is that possible?
Thanks.
--
McGeeky
http://mcgeeky.blogspot.com
Thanks Mark and Eliyahu.
When replacing the existing connection string, will that apply to that
user''s session only or is it a global change?
--
McGeeky
http://mcgeeky.blogspot.com
"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:uw**************@TK2MSFTNGP04.phx.gbl..."McGeeky" <an**@anon.comwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
I am using SQLDataSources with the connection string hardcoded in the
web.config file under the connectionStrings element. However, I want
users
to be able to enter a username and password on a login page which I want
to
subsequently use in the connection string. Is that possible?
Yes - store the username and password (encrypted, if possible) in the
Session variable, and then just use the String.Replace() method on the
existing connection string.
--
http://www.markrae.net
这篇关于提示用户输入连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!