Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 10th, 2014, 08:53 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Define LocalSqlServer dynamically at run time

Hello,

As it's the first time I ask a question here I hope I'm doing it at the right place...

Here is my question : is there a way to define the LocalSqlServer string dynamically at run time?
I'm using .net 3.5, VS2008, c# and VB and it's for web projects.

Why do I want to do this?
Because I want the LocalSqlServer connection string data (host, login, password) to be centralised and not hard code on the web.config.

Ex: these data will be stored in the server system variables, managed by the IT, the websites will have to load and get these data to create the connectring at startup, there are many websites most of them will be using the same DB for LocalSqlServer.

Has I'm using the membership tables I must specify the LocalSqlServer string.

I hope my question and what I'm trying to do is enought clear... I'm yet far from being fluent in english !

Regards

Helder
  #2 (permalink)  
Old January 10th, 2014, 04:06 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

So you want your users to type in the connection string in when they log in?
  #3 (permalink)  
Old January 10th, 2014, 05:27 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello

No, just to be able to define the connection string for LocalSqlServer at the start of my application.
In this way I can create the connection based on aliases and server variables.
no real server name/ip, userid or password will be used in the code (I use SQL Users for connection)

But with some luck I found, a couple of hours ago, was I looking for!

In the web.config I specify custom Providers for the functionalities (Membership, Roles, WebParts, ...) I use that are using LocalSqlServer connection by default, instead I make then point to a Dummy SQL Connection string and I make my custom Provider be based on a SQL provider class (SqlMembershipProvider, SqlRoleProvider, ...) that is defined in my project.
On these SQL Provider classes I override the Initialize method allowing me to bypass the Dummy connection string and create the connection string as I want based on whatever variables I need.

So for me the topic could be claused!

Any way thanks for your help.
Best Regards

Helder

Last edited by hdossantos; January 10th, 2014 at 05:29 PM.
 


Thread Tools
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing LocalSqlServer with Providers sleepyone BOOK: Beginning ASP.NET 4 : in C# and VB 8 June 13th, 2011 09:26 AM
How do you add content to a tab control dynamically in wcf -- at run time? Bill_Thompson C# 2005 0 June 29th, 2010 11:43 PM
Modifying LocalSqlServer at runtime TwoTrees ASP.NET 3.5 Professionals 7 July 29th, 2008 01:12 PM
Design-Time or Run-Time now ? ALGNET .NET Framework 2.0 1 July 31st, 2006 05:43 AM
Run time Help Dazzer96 Access VBA 2 May 3rd, 2006 08:03 AM



All times are GMT -4. The time now is 05:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.