Re: connect from webservice
- From: "Roman Rehak" <rrehak@xxxxxxxxxxx>
- Date: Mon, 9 Jul 2007 00:33:27 -0400
in web.config:
<appSettings>
<add key="ConnectionString" value="Data Source=MyServer;Initial
Catalog=AdventureWorks;User Id=MyUser;Password=MyPassword;"/>
</appSettings>
in the web service:
string cnString =
ConfigurationManager.AppSettings.Get("ConnectionString");
Roman
--
Roman Rehak
http://sqlblog.com/blogs/roman_rehak
"wendld" <GenieLifts@xxxxxxxxxxxxxx> wrote in message
news:D1B8082F-16ED-47B7-9FD8-C5A1EBF26DED@xxxxxxxxxxxxxxxx
This is my first attempt at pulling in the connection string from the
machine.config. Windows Authentication is not an option since the database
and webservers are on different domains and a DMZ is in use. I currently
have
the SSL encryption on, but have not encrypted the actually value in the
config file (yet). That is the next step after I get the programs working
this way.
"Roman Rehak" wrote:
It's not any different than connecting from an ASP.NET page so if you
know
how to do that, you should be all set. It's not a good practice to place
passwords in a config file so you should look into using Windows
authentication or at the very least encrypt the password in the config
file.
Roman
--
Roman Rehak
http://sqlblog.com/blogs/roman_rehak
"wendld" <GenieLifts@xxxxxxxxxxxxxx> wrote in message
news:7A009E7B-EE22-4FFC-8B4B-FE870659D985@xxxxxxxxxxxxxxxx
I have a webservice I am creating. I am needing to connect to a SQL
server
on
a different machine using SQL authetication. I have the connection
string
located in the machine.config. Could somebody give me a sample of how
to
use
that connection string to connect to the database from inside a
webservice.
.
- Follow-Ups:
- Re: connect from webservice
- From: wendld
- Re: connect from webservice
- References:
- Re: connect from webservice
- From: Roman Rehak
- Re: connect from webservice
- Prev by Date: Re: connect from webservice
- Next by Date: Re: SSPI context error.
- Previous by thread: Re: connect from webservice
- Next by thread: Re: connect from webservice
- Index(es):
Relevant Pages
|