Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amigo 245 posts 600 karma points
    Mar 06, 2011 @ 21:51
    Amigo
    0

    retreiving the admin user generates an error.

    im trying to retreive the admin user with: User user = new User(0);

    from some code in nforum i installed. but it throws:
    No node exists with id '0'

    i wonder why??

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Mar 06, 2011 @ 22:04
    Jan Skovgaard
    0

    Hi Amigo

    Could you perhaps post the whole code snippet? Maybe you're missing a reference or something?

    Where does i throw the error?

    /Jan

  • Amigo 245 posts 600 karma points
    Mar 07, 2011 @ 09:08
    Amigo
    0

    Hi Jan,

    Its when i edit a nforum user and i try to upload an profile image, the line:
    User user = new User(0); throw the error...

    .......
    Member m = Member.GetCurrentMember();
    m.getProperty("profileImage").Value = GenerateImage(FileUploadControl).Id;
    .......

            private Media GenerateImage(FileUpload ProfileImageUpload)
            {
                User user = new User(0);
             
                Media media = Media.MakeNew(CurrentMember.MemberLoginName, MediaType.GetByAlias("image"), user, MediaParentNodeId);

                string mediaPath = Server.MapPath("/media");
                string filePath = mediaPath + "/" + media.Id + "/" + ProfileImageUpload.PostedFile.FileName;

                Directory.CreateDirectory(mediaPath + "/" + media.Id);

                ProfileImageUpload.PostedFile.SaveAs(filePath);

                System.Drawing.Image.GetThumbnailImageAbort myCallback = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);

                Bitmap image = new Bitmap(ProfileImageUpload.PostedFile.InputStream);
                Bitmap thumb = (Bitmap)image.GetThumbnailImage(150, 150, myCallback, IntPtr.Zero);

                thumb.Save(filePath.Replace(".jpg", "_thumb.jpg"));

                media.getProperty("umbracoFile").Value = "/media/" + "/" + media.Id + "/" + ProfileImageUpload.PostedFile.FileName;

                return media;
            }

  • Amigo 245 posts 600 karma points
    Mar 07, 2011 @ 09:14
    Amigo
    0

    and i also have the : using umbraco.BusinessLogic; ...

  • Amigo 245 posts 600 karma points
    Mar 07, 2011 @ 09:22
    Amigo
    0

    hmmm, i just found out that it works when i haved a normal usercontrol in the umbraco site.
    But its not working when i try from the nforum project where the dll is copied to my site...

  • Amigo 245 posts 600 karma points
    Mar 09, 2011 @ 12:32
    Amigo
    0

    Hi Jan, it was my "MediaParentNodeId" that caused the problem..

    Problem solved.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies