Sharing Profiles from root WebConfig to subdirectory pages

Joined
Apr 20, 2008
Messages
2
Reaction score
0
In my root directory I have a webconfig file that sets up 2 profile properties.

i.e. name / email

I have asubdirectory called "info.aspx" that I would like to display the name and email profiles.

I can't seem to figure if it is possible to do this or not. If it is possible how would i approach this.

What I mean is in the info.aspx I have a button when clicked profile.name would equal the value in textbox1 this would then be stored to profile.name in the database. In the load event of info.aspx i'll have code that sets the textbox1 to equal profile.name so when the info.aspx is loaded the textbox1 gets populated with the stored data in the profile.name that was setup in the root webconfig file.

I hope i am making sense
please advise.
 
Joined
Apr 20, 2008
Messages
2
Reaction score
0
Here is what i'm trying to do

in the root web.config file i have a profile setup

<profile>
<properties>​
<add name="FullName" defaultValue="Anonymous" allowAnonymous="true"/>
<add name="Email" defaultValue="(e-mail address removed)" allowAnonymous="true"/>
<add name="myTheme" defaultValue="BlueFuse" allowAnonymous="true"/>​
</properties>​
<profile>

in my subdirectory called Settings

i have a aspx file called Settings.aspx
with the following vb code


Partial Class Settings
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtMyName.Text = Profile.FullName
txtMyEmail.Text = Profile.Email
ddlMyTheme.Items.FindByValue(Profile.myTheme).Selected = True​
End Sub

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Page.Theme = Profile.myTheme​
End Sub

Protected Sub btnUpdateSettings_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateSettings.Click
Profile.FullName = txtMyName.Text
Profile.Email = txtMyEmail.Text
Profile.myTheme = ddlMyTheme.SelectedValue
Response.Redirect("~/Settings/Settings.aspx")​
End Sub
End Class


When this is run if i don't set the txtMyName,txtMyEmail, and ddlMyTheme in the form load the profile information gets changed however I want the form load to load the values that were stored in the profiles. The only reason I know it works is because when I change my theme and the page does a redirect it changes the theme for me.

Does anyone know why I can't populate the txtboxes and dropdownlists with the profiles that were stored?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top