0

Works Locally but doesnt work when deployed to dev, using same kentico configuration settings on local and dev. Changes on local apply straight to dev.

So I am working on an existing project which is using Kentico. I have created a new web part and template and when trying to go the new page (web part) I receive this error.

Error loading the webpart '' of type ''

<%@ Control Language="C#" AutoEventWireup="true" 
Inherits="CMSWebParts_General_ResetPassword" 
CodeBehind="~/CMSWebParts/General/ResetPassword.ascx.cs" %>

<div id="reset-password-page" class="col-md-12">
    <div class="col-md-3">
    </div>
    <div class="col-md-6">
    <h1 style="color: white; margin-top: 0px;">Reset Password</h1>
    <div style="margin-top: 30px; color: #eb770a!important; padding-left: 20px;" class="row">
        <div class="form-group row">
            <span style="color: red; position: relative; left: 12px;" id="validation"></span>
        </div>
        <div class="form-group row">
            <asp:Label ID="lblPassword" runat="server" Text="Password:" CssClass="col-sm-3 control-label">Password:</asp:Label>
            <div class="col-sm-9">
                <asp:TextBox ID="txtPassword" runat="server" Text="" TextMode="Password" CssClass="form-control" ClientIDMode="Static" Monitor="Monitor" data-rel="password"></asp:TextBox>
            </div>
        </div>
        <div class="form-group row">
            <asp:Label ID="lblPassword2" runat="server" Text="Repeat Password:" CssClass="col-sm-3 control-label">Repeat Password:</asp:Label>
            <div class="col-sm-9">
                <asp:TextBox ID="txtPassword2" runat="server" Text="" TextMode="Password" CssClass="form-control" ClientIDMode="Static" Monitor="Monitor" data-rel="password"></asp:TextBox>
            </div>
        </div>
        <div class="form-group row">
            <div class="offset-sm-2 col-sm-10" id="reset">
                <asp:Button ID="ResetBtn" runat="server" CssClass="btn caseFileButton" Text="Reset" CausesValidation="True" />
            </div>
        </div>
    </div>
</div>
<div class="col-md-3"></div>

Here is the view essentially, however this is an old version of ASP - hence .ascx files.

This has been working, but very inconsistently, if there is any Kentico experts or ASP experts, some help would be appreciated.

I have a code behind file created, ResetPassword.ascx.cs

public partial class CMSWebParts_General_ResetPassword : CMSAbstractWebPart
{

    protected void Page_Load(Object sender, EventArgs e)
    {

This is in the event log

Message: Could not load type 'CMSWebParts_General_ResetPassword'

9
  • What steps are you taking to create the web part?
    – mnield
    Jan 25, 2018 at 12:57
  • I created a template and then created the web part. This works locally and my web part loads, however once deployed to the dev server, the web part stops working on dev.
    – Kallen
    Jan 25, 2018 at 14:24
  • @kallen you're going to have to provide more code behind OR more details about the setup and errors your receiving in order to provide some sort of solution. Jan 25, 2018 at 14:26
  • I'm sorry but unfortunately, Kentico seems to provide the most generic error possible, for something which could be caused by a simple syntax issue. When I go to pages on the dev site of kentico and go to the new page and click design, I get this Error loading the webpart 'ResetPassword' of type 'ResetPassword_1'
    – Kallen
    Jan 25, 2018 at 14:30
  • 1
    Has the code definitely compiled? That error would suggest that the code behind CMSWebParts_General_ResetPassword is not in the loaded assembly. (sorry if so, but I just wanted to be clear).
    – mnield
    Jan 25, 2018 at 16:13

2 Answers 2

4

Have you created the code behind file as well? I.e. ~/CMSWebParts/General/ResetPassword.ascx.cs. You'll need this too (and you may need to build it in Visual Studio if your project is a web application rather than a web project).

It sounds very much like the DLL does not contain the class for the web part code behind. if you're sure that the code is compiling on your local environment, you should take a look at the way in which the deployment to your dev environment is taking place. Ensure that the latest code has been pulled from your source control and that the solution has been correctly built prior to the files being deployed to the server.

If you're uncertain (in this instance of someone else doing the deployment), a good/quick way to check this is to look at the bin\cmsapp.dll and ensure that the date and time of the file reflects a recent update (i.e. likely to include your changes).

If your deployment is via file copy, you may wish to consider using some of the publish options in Visual Studio going forward.

1
  • Hi yes, I have the code behind file created, just didn't paste the code due to security issues.
    – Kallen
    Jan 25, 2018 at 14:22
0

This is now fixed - The issue was the CMSApp.dll had not been compiled correctly.

For example, after a get latest version of the code through version control, if a deployment from the file system to the server is being done then you need to load the solution and build it to recompile the dll.

Redeploy and fixed!

3
  • OK, nice to know it's fixed and that it was that the code was not deployed. Otherwise, it would end up being a more complex problem. Given the conversation in the comments on your original question, do mind if I edit my answer to reflect the conversation and you mark it as correct?
    – mnield
    Jan 26, 2018 at 11:08
  • Goo ahead! Your comment caused me to find my solution therefore you get the upvote!
    – Kallen
    Jan 26, 2018 at 12:57
  • Thank you. I've updated the answer to convey the detail in the comments from your question.
    – mnield
    Jan 30, 2018 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.