Menu

Server Error

prodikeyz
2006-12-31
2013-04-02
  • prodikeyz

    prodikeyz - 2006-12-31

    Hi, can someone help me out on this? Thanks in advance.

    I am trying to send an email with an embedded image. I used the example http://dotnetopenmail.sourceforge.net/examples.html - An email with an inline graphic

    It's written in C# and I changed it to VB.net for my online application. However, when I tried to run the .aspx page, I get the following error:

    ********************************************************************************************************************
    Security Exception
    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Source Error:

    Line 38:         Dim relatedFileInfo As FileInfo
    Line 39:         Dim relatedFileAttachment As FileAttachment
    Line 40:         relatedFileInfo = New FileInfo("test.jpg") <<- ERROR LINE
    Line 41:         relatedFileAttachment = New FileAttachment(relatedFileInfo, "hawthorns")
    Line 42:         relatedFileAttachment.ContentType = "image/jpeg"
    ********************************************************************************************************************

    What should I do? The 'test.jpg' is in my '/wwwroot' folder of my website. I put the 'dotNetOpenMail.dll' in '/bin' directory of my website.

     
    • Mike Bridge

      Mike Bridge - 2006-12-31

      Hi-

      It sounds like your server configuration's security settings aren't letting you access the filesystem.  This article might help:

         http://www.hostsstation.com/articles/article.aspx?artID=214

      -Mike

       
    • prodikeyz

      prodikeyz - 2006-12-31

      Ok.. I am awaiting reply from my webserver. thanks a lot.

      However, is there another way of embedding image in email other than using FileInfo when I wish to send emails using my web application? Many thanks for any help.

       
      • Mike Bridge

        Mike Bridge - 2006-12-31

        You could also read an image from another web server, or you could hardcode it, or maybe save it as a resource.  If it's the same all the time, these latter two options might work.

        You could also just put the file on your site and create an <img> reference to it.

        Cheers,

        -Mike

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.