Help with custom registration page.

Hi

I am trying to extend the existing registration functionality to be able to do few extra things. I downloaded the sample code from your site and I am trying to get it working first. The problem that I am having is after deploying it when I try to access the page it gives me 404 FILE NOT FOUND. I have narrowed down the problem to this line in my aspx page

<%@ Page Language="C#" Inherits="SPSolutions.CustomRegistration.CustomRegisterPage" MasterPageFile="~/_layouts/application.master" %>

I have  SPSolutions.CustomRegistration assembly in gac. I have tried to increase the trust level in web.config file to WS_Medium and also to Full. But somehow its just not working.

Its very urgent issue. Can you please help.

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Matthew McBride

    If your assembly is placed in the GAC it will run with full trust. No additional trust is required in the web.config file. When I get stuck in these type of situations I typically start removing all of my dependencies from my .aspx files. I would begin by removing all controls from the page except for a hello messages. Finally, you can try Inheriting from the LayoutsPageBase class which is the base class for most SharePoint layouts pages.

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.layoutspagebase.aspx

    Depending on what you are trying to accomplish it may be easier to modify the out-of-the-box register.aspx page. In this page you can override the OnRegistering and OnRegistered methods to perform actions. The samples below validate the length of the user name and modify profile properties associated with a user.

    <script runat="server"> 

    /// <summary>
    /// Define an empty registration event
    /// </summary>
    /// <param></param>
    protected override void OnRegistering(RegistrationEventProperties eventProperties)
    {

          if(eventProperties.UserName.Length < 8)
          {
                eventProperties.ErrorMessage = "You user name must be 8 characters.";
                eventProperties.Cancel = true;
          }
    }

    /// <summary>
    /// Define an empty registration event
    /// </summary>
    /// <param></param>
    protected override void OnRegistered(RegistrationEventProperties eventProperties)
    {

          // Update internal name
          eventProperties.Profile["InternalName"] = String.Format(
                "{0} {1}",
                eventProperties.Profile["FirstName"],
                eventProperties.Profile["LastName"]);

          // Save profile
          eventProperties.Profile.Save();
    }
    </script>

     

    Jeremy Luerkens
    Manager, Software Production
    SharePoint Solutions

Please sign in to leave a comment.