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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
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.
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