+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Specified cast is not valid.

Specified cast is not valid.

5 posts, 0 answered
  1. Michael
    Michael avatar
    35 posts
    Registered:
    04 Nov 2010
    10 Nov 2010
    Link to this post
    I get the following error when 1) creating a new newsletter, then 2) clicking on the 'Next: Write Content' link button:

    Specified cast is not valid.

    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.InvalidCastException: Specified cast is not valid.

    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: 

    [InvalidCastException: Specified cast is not valid.]
       Telerik.Notifications.Newsletters.WebControl.CreateNewsletter.OnWriteContent(ControlPanel cntrlPnlObj) +306
       Telerik.Notifications.Newsletters.WebControl.CreateNewsletter.button_Command(Object sender, CommandEventArgs e) +297
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Nov 2010
    Link to this post
    Hi Michael,

    We are not able to replicate this issue locally. Can you reproduce it on our demo website?
    If you use Active Directory where the users are identified by SID you may get this error. Sitefinity uses Guid and the newsletter expects Guid instead of SID. If this is the case you need to convert SID to GUID or use Guids with AD. You should override the membership provider classes and make a Guid - SID mapping. By default we call GetUser by  ProviderUserKey

    (Guid)UserManager.Default.GetUser().ProviderUserKey

    sample

    public override  MembershipUser GetUser(object providerUserKey, bool  userIsOnline)
    {
        // check if providerUserKey is Guid and get its mapped SID
        return base.GetUser(providerUserKey, userIsOnline);
    }


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Michael
    Michael avatar
    35 posts
    Registered:
    04 Nov 2010
    10 Nov 2010
    Link to this post
    Yes, I'm using AD.
  4. Michael
    Michael avatar
    35 posts
    Registered:
    04 Nov 2010
    10 Nov 2010
    Link to this post
    Is there an easier way than having to implement my own membership provider? LOL
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    10 Nov 2010
    Link to this post
    Hi Michael,

    The method OnWriteContent is private and it cannot be overridden, so the only way is making a Guid - SID mapping.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
5 posts, 0 answered