Thanks for your response Adrian,
Yes, as for your scenario, i'll be hard to utilize the current
configuration model of the sqlcache. However, because the sqlcache need to
be pre configured for each application(since the asp.net runtime need to
constantly do data polling from database), we need to specify the complete
server connection info at design-time rather than runtime. Anyway, i'll
forward this request to our dev team though I think it may takes time for
them to change the current sqlcache configuration model.
Thanks for your understanding.
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Adrian Parker" <
[email protected]>
| References: <O2VF#
[email protected]>
<
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: Re: SqlCacheDependency - repost in hopes of a reply
| Date: Fri, 21 Oct 2005 07:56:50 +0100
| Lines: 199
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 82-37-128-226.cable.ubr01.telf.blueyonder.co.uk
82.37.128.226
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:132956
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven,
|
| So in summary, because we cannot expose the database credientials to the
| network people who would be specifying the dbserver/dbname, we cannot use
| SqlCacheDependency as that requires you to compromise db security by
| including the credentials in the web.config, which isn't possible when
they
| have to be specified at runtime.
|
| If this is the case, then you really need to change this.
|
| Thanks
| Adrian Parker
|
| | > Hi Adrian,
| >
| > As for the connectionstring setting for ASP.NET 2.0's SqlDependecy
| > caching,
| > it must be configured in web.config file and asp.net runtime will always
| > retrieve the configuration from there. En, if you do need to
dynamically
| > specify such connectionstring setting, we can consider using the .net
| > 2.0's
| > configuration api to do it in applicatino_Start event, for example:
| >
| > ============
| > void Application_Start(Object sender, EventArgs e) {
| > // Code that runs on application startup
| > Configuration config =
| >
| >
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpCo
| > ntext.Current.Request.ApplicationPath);
| > ConfigurationSectionGroup group =
| > config.SectionGroups["system.web"];
| > config.ConnectionStrings.ConnectionStrings.Add(
| > new ConnectionStringSettings( "aaa", "Data
| > Source=localhost;Initial Catalog=testdb;Integrated Security=True")
| > );
| >
| > SystemWebCachingSectionGroup cachesg =
| > group.SectionGroups["caching"] as SystemWebCachingSectionGroup;
| >
cachesg.SqlCacheDependency.Databases["TestDB"].ConnectionStringName
| > = "aaa";
| >
| > config.Save();
| > }
| > ================
| >
| > actually the configuration api just provde the easy to use adminstation
| > interfaces for manipulating web.config(or app config....)
| >
| > However, since it'll cause the web.config be modifed at runtime, we are
| > recommended to avoid using them in our application code as much as
| > possible.
| >
| > Thanks,
| >
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure!
www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | From: "Adrian Parker" <
[email protected]>
| > | References: <O2VF#
[email protected]>
| > <
[email protected]>
| > | Subject: Re: SqlCacheDependency - repost in hopes of a reply
| > | Date: Fri, 21 Oct 2005 00:19:54 +0100
| > | Lines: 89
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Response
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | Message-ID: <
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 82-37-128-226.cable.ubr01.telf.blueyonder.co.uk
| > 82.37.128.226
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:132905
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Harry, thanks for responding..
| > |
| > | Basically, the problem as we see it is that to use
SQLCacheDependency,
| > it
| > | seems that you have to use a hard coded connection string in the cache
| > | section of the web.config, which isn't going to work for us because we
| > | cannot expose the specific database credentials to the network people
| > who
| > | would be specifying the DBserver and DBname to connect to; We can't
have
| > the
| > | whole connection string in the web.config, and so have to build it in
| > the
| > | application at runtime e.g.
| > |
| > | constr = "Data Source=" + aDBServer + ";Initial Catalog=" + aDBName +
| > ";User
| > | ID=" + aUser + ";pwd=" + aPwd
| > |
| > | We know the user and password, but not the dbserver or dbname
| > | and the customer network people know the dbserver and name, but not
the
| > user
| > | or password.
| > |
| > | So how do we use cache dependency without hard coding the connection
| > string
| > | in the web.config ?
| > |
| > | Many Thanks
| > | Adrian
| > |
| > | | > | > Maybe I'm just easily confused - but are you asking about [how to
| > | > dynamically encrypt a dynamically created connection string], or
how
| > to
| > | > [dynamically create a sqlCacheDependency]? or both?
| > | >
| > | > Normally I wouldn't reply if I don't understand the question - but
| > | > apparently nobody else is answering; perhaps they're confused as
well.
| > | > Maybe it would help to break up this "master question" into
individual
| > | > other more specific questions; one for the connection string,
another
| > for
| > | > the dynamic sqlCacheDependency. I'd take a shot at answering both
here
| > -
| > | > but I don't know the answers!
| > | >
| > | > -GH
| > | >
| > | >
| > | > | > | >> I've got the standard SqlCacheDependency working just fine , ie.
I've
| > | >> defined (and encrypted) the connectionStrings section in the
| > web.config,
| > | >> and
| > | >> I've also defined an an sqlCacheDependency in the caching section.
| > So,
| > in
| > | >> my
| > | >> code I add an item to the cache with an sqlCacheDependency,
| > referencing
| > | >> the
| > | >> named sqlCacheDependency in the web.config and the database table
it
| > is
| > | >> to
| > | >> be based on (have enabled notificiations for that table). Fine.
| > | >>
| > | >> What I'd like to do however is too dynamically build the connection
| > | >> strings
| > | >> and define the sqlCacheDependencies dynamically as well (ie not in
| > the
| > | >> web.config), although thats thats too important, it's the
connection
| > | >> string
| > | >> I'm really interested in.
| > | >>
| > | >> I've been on the web, even had a look at the .net classes using the
| > | >> reflector.exe. I've tried creating a SqlCacheDependencyDatabase
| > | >> dynamically
| > | >> but when I try and reference it by name in the constructor for
| > | >> sqlCacheDependency it can't find it because it's only looking at
ones
| > | >> that
| > | >> have been loaded from the web.config.
| > | >>
| > | >> The reason the connection strings have to be dynamically created is
| > that
| > | >> the
| > | >> app is deployed on several different client sites, and they have
| > control
| > | >> over the db server and the db name, but we need to keep the user
name
| > and
| > | >> password to ourselves. We already build our connection strings
| > | >> dynamically
| > | >> for normal db stuff. We have a custom section within the web
config
| > | >> where
| > | >> the client puts the db server and the db name.
| > | >>
| > | >> It doesn't seem like such an strange thing to want to do, either
I'm
| > | >> missing
| > | >> something or it's harder than it should be.
| > | >>
| > | >>
| > | >>
| > | >>
| > | >>
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|