Creating addition profile information for users.

So here is my current issue.

I have a user register on the register page in the root directory.  This is done with the create user wizard.  It works fine and creates ApplicationId, UserId, UserName, ect... in the aspnet_Users (dbo).  Then the user can edit / view their profile via the included attached pages that sit in the protected member directory.  This also works (somewhat).

The problem is that the asp.net profile provider blobs the fields together in the aspnet_Profile(dbo) table.

By doing this I can't query or run stored procedures against the database which is a necessity.

I have tried to use the sandbox project with no success.  I know no C# and limited VB but I'm reading and learning more everyday.

I have also tried to customized the create user wizard but cannot get it to save the data into my database.  I tried to follow the 4 guys from rolla's example but it is in C# and makes absolutely no sense to me.

Please someone help me before I loose my mind.
 

0
mcove
3/7/2008 9:18:02 PM
asp.net.personalization 3779 articles. 0 followers. Follow

3 Replies
536 Views

Similar Articles

[PageSpeed] 2

Hello,

I suggest you stick to the 4GuysFromRola article and use one of available online C# to VB.NET conversion tools. For example, just copy the code from the article (or parts of the code) and paste it into conversion text box on http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx.

I hope this will help you.

Regards,
Sasa


http://www.vegaitsourcing.rs
http://www.codeplex.com/aspnetlibrary
0
Sasa
3/9/2008 2:30:55 PM

Using the 4GuysFromRola article was my thoughts also.

I tried using the conversion tool but still have had no success.

 

My SqlDataSource is located in the CreateUserWizardStepLocation section of the CreateUserWizard of my register.aspx page.

<asp:SqlDataSource ID="InsertLocation" runat="server" ConnectionString="mcoveConnectionString"
insertcommand="INSERT INTO [UserAddresses] ([UserId], [Country], [State], [City], [PostalCode]) VALUES (@UserId, @Country, @State, @City, @PostalCode)" providerName="System.Data.SqlClient">
                        <InsertParameters>
                            <asp:ControlParameter Name="Country" Type="String" ControlID="Country" PropertyName="Text" />
                            <asp:ControlParameter Name="State" Type="String" ControlID="State" PropertyName="Text" />
                            <asp:ControlParameter Name="City" Type="String" ControlID="City" PropertyName="Text" />
                            <asp:ControlParameter Name="PostalCode" Type="String" ControlID="PostalCode" PropertyName="Text" />
                        </InsertParameters>
                </asp:SqlDataSource>
 

 

Here is my .vb codebehind

Partial Class register
    Inherits System.Web.UI.Page

    Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedUser
        Dim UserNameTextBox As TextBox = DirectCast(CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName"), TextBox)
        Dim DataSource As SqlDataSource = DirectCast(CreateUserWizardStepLocation.FindControl("InsertLocation"), SqlDataSource)

        Dim User As MembershipUser = Membership.GetUser(UserNameTextBox.Text)
        Dim UserGUID As Object = User.ProviderUserKey

        DataSource.InsertParameters.Add("UserId", UserGUID.ToString)
        DataSource.Insert()

    End Sub

End Class

 

The register page loads correctly and allows the controls to be filled in.  Once the the Create User button is clicked an error occurs before the create user wizard proceeds. And here is the error I get. 

Server Error in '/' Application.

Format of the initialization string does not conform to specification starting at index 0.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

Source Error:

Line 11: 
Line 12: DataSource.InsertParameters.Add("UserId", UserGUID.ToString)
Line 13: DataSource.Insert()
Line 14:
Line 15: End Sub

Source File: e:\web\public_html\mcove\register.aspx.vb    Line: 13
 

0
mcove
3/9/2008 8:56:02 PM

Well I have decided to scrap using vb and just learn c#.

I have gotten everything to work on my local computer test server but I cannot get it to work on the production server so I think the issue is in my SqlDataSource.

 

Using this SqlDataSource I can insert to the local aspnetdb in the app_data folder.

<asp:SqlDataSource ID="InsertExtraInfo" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>"
                        InsertCommand="INSERT INTO [UserAddresses] ([UserId], [Country], [State], [City], [PostalCode]) VALUES (@UserId, @Country, @State, @City, @PostalCode)"
                        ProviderName="<%$ ConnectionStrings:ASPNETDBConnectionString1.ProviderName %>">
                        <InsertParameters>
                            <asp:ControlParameter Name="Country" Type="String" ControlID="Country" PropertyName="Text" />
                            <asp:ControlParameter Name="State" Type="String" ControlID="State" PropertyName="Text" />
                            <asp:ControlParameter Name="City" Type="String" ControlID="City" PropertyName="Text" />
                            <asp:ControlParameter Name="PostalCode" Type="String" ControlID="PostalCode" PropertyName="Text" />
                        </InsertParameters>
                       
                    </asp:SqlDataSource>

 

 

This is the SqlDataSource I am currently trying to use but it does not save the record into the sql server database.

                <asp:SqlDataSource ID="InsertExtraInfo" runat="server" ConnectionString="<%$ ConnectionStrings:mcoveConnectionString %>"
                    InsertCommand="INSERT INTO [UserAddresses] ([UserId], [Country], [State], [City], [PostalCode]) VALUES (@UserId, @Country, @State, @City, @PostalCode)"
                    ProviderName="<%$ ConnectionStrings:mcoveConnectionString.ProviderName %>">
                        <InsertParameters>
                            <asp:ControlParameter Name="Country" Type="String" ControlID="Country" PropertyName="Text" />
                            <asp:ControlParameter Name="State" Type="String" ControlID="State" PropertyName="Text" />
                            <asp:ControlParameter Name="City" Type="String" ControlID="City" PropertyName="Text" />
                            <asp:ControlParameter Name="PostalCode" Type="String" ControlID="PostalCode" PropertyName="Text" />
                        </InsertParameters>
                </asp:SqlDataSource>

 

The create user wizard creates the new member in the aspnet_Users table but the new record in the UserAddresses table is not created.  Any ideas?

0
mcove
3/10/2008 3:42:05 AM
Reply:

Web resources about - Creating addition profile information for users. - asp.net.personalization

Information - Wikipedia, the free encyclopedia
Information (shortened as info or info. ) is that which informs, i.e. an answer to a question, as well as that from which knowledge and data ...

InformationWeek – Latest Information Technology (IT) news & IT articles - Technology news - IT magazine ...
InformationWeek provides latest Information technology (IT) news online & articles and publishes latest tech news & IT magazine for Indian IT ...

Australian public service failing to share information: Public Sector Data Management report
Agencies spending years to agree to share a few tables of data. Two agencies needed 11 agreements to share information.

Magnetic protein may provide animals with navigation information
What do monarch butterflies, salmon, lobsters, bats, mole rats, and marine nudibranch mollusks have in common? As I'm sure you already knew, ...

Apple’s secrets: How Apple’s legal fight with Samsung revealed a gold mine of top-secret information
Following a contentious patent battle that raged on for nearly five years, Samsung last week finally agreed to pay Apple $548 million in damages ...

White House offers states more information on refugees
Governors are still clashing with the administration over whether to admit Syrian refugees into their states

VTech hack exposes personal information of millions of customers
Children's technology and educational toy maker VTech announced that it was recently a victim of a data breach that exposed sensitive information ...

Transcend Information posts increased revenues for November
Transcend Information has reported consolidated revenues of NT$2.322 billion (US$70.7 million) for November 2015, representing a 5.67% increase ...

VTech hack exposes personal information of 5 million adults and children
Another data breach? Won't someone please think of the children?

Information Inflation
VideoThe universe is full of information and entropy is come along with the manifestation and interpretation of it. Therefore, the universe consists ...

Resources last updated: 12/9/2015 12:13:47 PM