Registering a new member via website user control error
I am setting up a mailing list and need to have email address and names stored in the members section (with a member being created automatically). I have written a register user control that should work but I am getting an error. Any help would be greatly appreciated... I am basing this off of some code from Tim:
Error creating usercontrol (/usercontrols/website/register.ascx) Could not load type 'UmbracoCreateMember.Register'. at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean
allowBuildInPrecompile) at
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
context, VirtualPath virtualPath, Boolean noBuild, Boolean
allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at umbraco.macro.loadUserControl(String fileName, Hashtable attributes, Hashtable pageElements)
That seems to be the problem, there is no umbracocreatemember.register file in the class view. This is all adapted from Tim's blog post here, how can I get this to work?
I dont know where that is...basically what I did was create a usercontrol in umbraco and added the ascx and the codebehind, I did not build anything in VS....What do I need to do to get this to work...
I would actually recommend to look into the Microsoft member provider
(as Umbraco 4.0.1 supports it). You can very easily create members
using that method.
I don't currently have sample code for you, but it doesn't require any work in VS. Give Google a try! :)
Ok I have built the solution and copied over the DLL file and I still get the same error....This is my first user control creation so please bear with me....I built the project in VS, pulled the dll over and copied over the ascx code as well as the code behind and I am still getting the same error...
I'm just guessing here, but you downloaded Tim's sample project and copied the full text in Register.ascx and Register.ascx.cs to your own user controls, right?
If that is what you did, I suggest you start over.
1) Delete your user control and create a new one.
2) In cs-file, just copy the two parts that Tim describes.
using umbraco.cms.businesslogic.member; using umbraco.cms.businesslogic.propertytype;
I have everything somewhat working now, I changed the code behind file to go to id 1093 (the id of my membertype), but everytime I hit register I keep getting an error that says the following: I have reset my cache and everything, any ideas?
Server Error in '/' Application.
No Contenttype with id: 1040
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: No Contenttype with id: 1040
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
It gets a bit more complicated if you have a namespace directive aswell. That depends on if you started the project as a website or webapplication in VS. Then you'll have to make sure your namespace is not the same as the one declared in the UmbracoCreateMember.dll.
Any ideas, I just did another fresh copy and changed the id of the member type to 1093 and it always reverts back to 1040 somehow (not in the code, only on the website) Please someone help me out!
It seems as it's pulling the values from the createMember.dll that you added to the bin-files earlier. That file consists of a precompiled version of Tim's sample code. That's why you will not find 1040 in your solution.
If you havn't solved it yet, can't you post your UserControl-files (both ascx- and cs-file) and we'll try to solve it from there. Also, remove the CreateMember.dll if it's in your bin-directory. Otherwise it might pull values from there.
Registering a new member via website user control error
I am setting up a mailing list and need to have email address and names stored in the members section (with a member being created automatically). I have written a register user control that should work but I am getting an error. Any help would be greatly appreciated... I am basing this off of some code from Tim:
ASCX Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Register.ascx.cs" Inherits="UmbracoCreateMember.Register" %>
<asp:Label ID="lblName" runat="server" Text="Name:"></asp:Label><asp:TextBox ID="txtName"
runat="server"></asp:TextBox><br />
<asp:Label ID="lblEmail" runat="server" Text="Email:"></asp:Label><asp:TextBox ID="txtEmail"
runat="server"></asp:TextBox><br />
<asp:Button ID="btnRegister" runat="server" Text="Register"
onclick="btnRegister_Click" />
Error:
Could not load type 'UmbracoCreateMember.Register'.
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
at umbraco.macro.loadUserControl(String fileName, Hashtable attributes, Hashtable pageElements)
Make sure that the namespace in your Register.ascx.cs is correct.
In Visual Studio you can go into the class explorer to see if the class UmbracoCreateMember.Register actually exists.
That seems to be the problem, there is no umbracocreatemember.register file in the class view. This is all adapted from Tim's blog post here, how can I get this to work?
Did you compile the project in Visual Studio?
If you look at the Register.ascx.cs file, there's the class that you need, so it does exist.
Looks like you didn't copy the dll to the bin-folder.
HTH,
Peter
What dll do I need to copy over?
UmbracoCreateMember.dll
I dont know where that is...basically what I did was create a usercontrol in umbraco and added the ascx and the codebehind, I did not build anything in VS....What do I need to do to get this to work...
I would actually recommend to look into the Microsoft member provider (as Umbraco 4.0.1 supports it). You can very easily create members using that method.
I don't currently have sample code for you, but it doesn't require any work in VS. Give Google a try! :)
Ok I have built the solution and copied over the DLL file and I still get the same error....This is my first user control creation so please bear with me....I built the project in VS, pulled the dll over and copied over the ascx code as well as the code behind and I am still getting the same error...
I'm just guessing here, but you downloaded Tim's sample project and copied the full text in Register.ascx and Register.ascx.cs to your own user controls, right?
If that is what you did, I suggest you start over.
1) Delete your user control and create a new one.
2) In cs-file, just copy the two parts that Tim describes.
And
You can watch Tim's version of Register.aspx.cs to see where they should be located.
3) in ascx-file copy everything below the first line
Try that, and see what happens.
/Fredrik
Thanks that seemed to have worked perfectly, thanks.
The styling looks a bit messed up in my last post, but hopefully you can find it by looking at the sample project from Tim or in his blog post.
/Fredrik
I have everything somewhat working now, I changed the code behind file to go to id 1093 (the id of my membertype), but everytime I hit register I keep getting an error that says the following: I have reset my cache and everything, any ideas?
Server Error in '/' Application.
No Contenttype with id: 1040
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: No Contenttype with id: 1040
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Just did a search in the entire project an 1040 is not found anywhere, why would it be doing this?
Now it looks like it's taking the Click-event from the UmbracoCreateMember.dll that you added earlier.
It's important that your declaration in ascx-file inherits from your cs-file
ascx-file
cs-file
It gets a bit more complicated if you have a namespace directive aswell. That depends on if you started the project as a website or webapplication in VS. Then you'll have to make sure your namespace is not the same as the one declared in the UmbracoCreateMember.dll.
ok Explain this again? Where is it pulling 1040 from so I can change it to have it go to the correct membertype...
Any ideas, I just did another fresh copy and changed the id of the member type to 1093 and it always reverts back to 1040 somehow (not in the code, only on the website) Please someone help me out!
I just created a new WebUserControl and referenced umbraco.dll, cms.dll and businesslogic.dll
The code is as follows:
member.ascx
member.ascx.cs (replace YourMemberTypeAlias)!
Create a macro with this user control in it and place it in your template.
Be sure to put the <form runat="server"> tag around the macro in your template.
It works fine for me, you can build further upon this..
Hope this helps you!
It seems as it's pulling the values from the createMember.dll that you added to the bin-files earlier. That file consists of a precompiled version of Tim's sample code. That's why you will not find 1040 in your solution.
If you havn't solved it yet, can't you post your UserControl-files (both ascx- and cs-file) and we'll try to solve it from there. Also, remove the CreateMember.dll if it's in your bin-directory. Otherwise it might pull values from there.
is working on a reply...