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 |
![]() |
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 |
![]() |
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 |
![]() |
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 |
![]() |