Help with simple User Control
Last Post 12/22/2008 6:52 PM by Joseph Craig. 8 Replies.
Author Messages
rodriguez
Nuke Active Member
Nuke Active Member
Posts:26


--
12/10/2007 8:03 AM

    I am trying to make a barebones user control for a module in DotNetNuke.  I apologize if this isn't the right forum.   The module compiles and can be added to the list of available modules in the Control Panel:  But in the container, I receive the following error.  The name of the control is Login2.  It simply outputs the information entered by the user in a login box.

    This is the error I receive

    Error: Login2 is currently unavailable.
    DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type 'ASP.admin_skins_login_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. ---> System.InvalidCastException: Unable to cast object of type 'ASP.admin_skins_login_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

    Here is the code for the user control named Login2.ascx

    <%</FONT><FONT color=#0000ff size=2>@</FONT><FONT size=2> </FONT><FONT color=#a31515 size=2>Control</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>Language</FONT><FONT color=#0000ff size=2>="VB"</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>AutoEventWireup</FONT><FONT color=#0000ff size=2>="false"</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>CodeFile</FONT><FONT color=#0000ff size=2>="Login2.ascx.vb"</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>Inherits</FONT><FONT color=#0000ff size=2>="AlteinEnterprises.CoffeeShopListing.Login2"</FONT><FONT size=2> %>

    <table style="border-style:solid; border-color: Black;">
    <
    tr>
      <td><b>Loginb>td>
      <td><asp:TextBox ID="User" runat="server" />td>
    tr>
    <
    tr>
      
    <td><b>Passwordb>td>
      
    <td><asp:TextBox ID="Pass" runat="server" />td>
    tr>
    <
    tr>
     
    <td>td>
     
    <td><b>Passwordb>td>
     
    <td><asp:Button id="buttton" Text="Submit" runat="server" />td>
    tr>
    table>
    <
    p><asp:Label ID="lblMessage" runat="server" />p>

    This is the code-behind for the user control

    Imports DotNetNuke
    Namespace AlteinEnterprises.CoffeeShopListinga
    Partial Class Login2
        
    Inherits Entities.Modules.PortalModuleBase

    Public UserName As String

    Public Password As String

    Public Sub Submit(ByVal Sender As Object, ByVal e As EventArgs)

    lblMessage.Text = "UserName: " & User.Text & _

    "
    "
    & "Password: " & Pass.Text & ""

    End Sub
    End Class
    End
    Namespace

    I do not know why I am receiving this error and I would be so very appreciative if some one could help me out.

    Thanks,
    altein

    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/10/2007 8:16 AM
    >Namespace AlteinEnterprises.CoffeeShopListinga

    If that's not a transcription error, remove the "a" at the end of the line.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    rodriguez
    Nuke Active Member
    Nuke Active Member
    Posts:26


    --
    12/10/2007 8:31 AM
    Hi,

    Namespace AlteinEnterprises.CoffeeShopListinga

    the 'a' is just a typo. In my code, it doesn't exist. It is only AlteinEnterprises.CoffeeShopListing

    Thanks,
    altein
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/10/2007 8:48 AM
    Looking more ... the error messages seem to refer to the skin. Are you including this module in your skin?

    One way to go about debugging this would be to install a version of DNN on a local computer, add this module and skin, and then run the web site under Visual Web Developer or Visual Studio. If you do that you can check for compile errors, set breakpoints, etc. That would probably help you locate the source of the problem more easily.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/10/2007 9:10 AM
    Oh, just another thought. If you are trying to mimic the DotNetNuke login module, you might want to take a look at it's source. In particular, the code-behind for that "Inherits UserModuleBase" which is different than your code.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    rodriguez
    Nuke Active Member
    Nuke Active Member
    Posts:26


    --
    12/10/2007 9:22 AM
    Dear Mr. Craig,

    Thank you so much for your advice and information.  It turns out I just had the "login" user control, login.ascx, set as the control for the "login2" (the module I created) module in the module definitions.  I just changed the user control for the module "login2" to the login2.ascx.

    My apologies,
    Thanks again
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/10/2007 9:24 AM
    Super!

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    Avi K
    Nuke Newbie
    Nuke Newbie
    Posts:1


    --
    12/22/2008 5:41 AM

    Hi,

    I have created my own login page and added Account Login module on it. It was working fine for me few days before. After that I deleted that login Pgae.

    Now I have again created login page and trying to add account login module on it, however, I am getting following error in view mode. and due to that login fuctionality is not working for my website.

    DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type 'ASP.admin_skins_login_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. ---> System.InvalidCastException: Unable to cast object of type 'ASP.admin_skins_login_ascx' to type 'DotNetNuke.Entities.Modules.PortalModuleBase'. at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

    Please let me know if any one knows about it.



    Joseph Craig
    DNN MVP
    Posts:11667


    --
    12/22/2008 6:52 PM
    I don't recognize this problem.

    Are you able to login to your site if you browse to http://yoursite.com/?ctl=login?

    You might also try http://login.aspx.

    Joe Craig, Patapsco Research Group
    Complete DNN Support


    ---