Click here to Skip to main content
15,920,675 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Doubt? Pin
srilu nagalla25-Oct-06 20:51
srilu nagalla25-Oct-06 20:51 
GeneralRe: Doubt? Pin
ednrgc27-Oct-06 7:21
ednrgc27-Oct-06 7:21 
Questionneed a today plug-in sample in vb.net cf Pin
spunky1a25-Oct-06 8:21
spunky1a25-Oct-06 8:21 
QuestionHow to debug when I'm developing an outlook add-in using COM? [modified] Pin
OctopusThu25-Oct-06 6:41
OctopusThu25-Oct-06 6:41 
Questionwhich dll should i import/reference?? Pin
K edar V25-Oct-06 3:12
K edar V25-Oct-06 3:12 
QuestionParameters Pin
Tauseef A24-Oct-06 10:37
Tauseef A24-Oct-06 10:37 
AnswerRe: Parameters Pin
sujithkumarsl25-Oct-06 6:25
sujithkumarsl25-Oct-06 6:25 
QuestionHow to change Profile provider at runtime Pin
lyhn24-Oct-06 0:47
lyhn24-Oct-06 0:47 
Question - How can the profile provider be specified at runtime?

Explanation:
I have two systems, one for 'Test' and one for 'Live' and each has a Sql Server.
When 'Test' code is published to 'Live' I currently have to edit connection strings in web.config to ensure that the live system does not access the test database and vice versa.
This method is prone to error so for Membership and Roles, I have created providers for Test and Live and select the correct provider at runtime. (This is achieved by recognising the machine name of the Test server).
eg
MembershipProvider myMembershipProvider =
Membership.Providers["CustomAspNetSqlMembershipProvider"];
MembershipUser myMember = myMembershipProvider.GetUser(strUsername, true);

However, the same syntax does not seem to be available for Profile.
I need to select the profile provider at runtime, but the defaultProvider is always used.

Extract from Web.config
<profile enabled="true" defaultprovider="CustomAspNetSqlProfileProvider" automaticsaveenabled="true">
<providers>
<clear>
<add name="CustomAspNetSqlProfileProvider" connectionstringname="LiveSqlServer" applicationname="myApp"
="" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<add name="LocalAspNetSqlProfileProvider" connectionstringname="LocalSqlServer" applicationname="myApp"
="" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

<properties>
<add name="Firstname">
<add name="Lastname">
<add name="Comments">




The following code creates a ProfileCommon using the default provider
ProfileCommon mProfile = new ProfileCommon();
mProfile.Initialize("myUsername", true);

I would like to use the LocalAspNetSqlProfileProvider on the 'Test' system, and use the CustomAspNetSqlProfileProvider on the 'Live' system.

The following line fails because the 'Live' SQLServer is unavailable from 'Test'
TextBox1.Text = mProfile.Firstname;

How can the profile provider be specified at runtime?
Confused | :confused:
AnswerRe: How to change Profile provider at runtime Pin
lyhn24-Oct-06 0:55
lyhn24-Oct-06 0:55 
Questionupgrade Pin
Ballita23-Oct-06 20:57
Ballita23-Oct-06 20:57 
AnswerRe: upgrade Pin
Dan Neely24-Oct-06 2:13
Dan Neely24-Oct-06 2:13 
QuestionManaged DirectX 2.0 Beta Removed Pin
wout de zeeuw23-Oct-06 17:14
wout de zeeuw23-Oct-06 17:14 
Questionthread problem Pin
Tauseef A20-Oct-06 23:08
Tauseef A20-Oct-06 23:08 
AnswerRe: thread problem Pin
indianet23-Oct-06 5:24
indianet23-Oct-06 5:24 
Questionhi Com port communication Pin
Tauseef A18-Oct-06 21:06
Tauseef A18-Oct-06 21:06 
Questionhi help me plz Pin
Tauseef A18-Oct-06 21:00
Tauseef A18-Oct-06 21:00 
AnswerRe: hi help me plz Pin
Christian Graus19-Oct-06 5:41
protectorChristian Graus19-Oct-06 5:41 
AnswerRe: hi help me plz Pin
Mike Dimmick19-Oct-06 6:45
Mike Dimmick19-Oct-06 6:45 
QuestionRe: hi help me plz Pin
Tauseef A19-Oct-06 7:07
Tauseef A19-Oct-06 7:07 
QuestionActivedocument error - word addin problem Pin
K edar V18-Oct-06 20:08
K edar V18-Oct-06 20:08 
AnswerRe: Activedocument error - word addin problem Pin
Dave Sexton18-Oct-06 20:19
Dave Sexton18-Oct-06 20:19 
GeneralRe: Activedocument error - word addin problem Pin
K edar V18-Oct-06 20:22
K edar V18-Oct-06 20:22 
Question.NET WebMethods - Serialization Pin
Simon P Stevens18-Oct-06 5:58
Simon P Stevens18-Oct-06 5:58 
QuestionSQL Server 2000 Notification Services and .NET 2.0 Pin
asasov17-Oct-06 21:01
asasov17-Oct-06 21:01 
AnswerRe: SQL Server 2000 Notification Services and .NET 2.0 Pin
The Man from U.N.C.L.E.19-Oct-06 7:28
The Man from U.N.C.L.E.19-Oct-06 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.