TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tekk
NA
101
0
Security.SecurityException while sending mail with attachment on my hosting server
May 6 2010 6:45 AM
hi friends,
I am using .Net framework 3.5 and Microsoft VS 2008,
here's the scenario:
Am sending mail with attachment from my hosting server, I get securityexception error. but app works fine on my local machine but whenever I try to run it from my hosting server, I get following errors:
---------------------------------------------------------------------------------------------------------------------------------------------------------
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.
----------------------------------------------------------------------------------------------------------------------------------------------------------
Here my code:
MailMessage objEmail = new MailMessage();
objEmail.To.Add(txtemail.Text.ToString());
objEmail.From = new MailAddress("
[email protected]
");
objEmail.Subject = "User Account Details";
objEmail.Body ="Your User Account was created as a " ;
objEmail.Priority = System.Net.Mail.MailPriority.High;
objEmail.IsBodyHtml = true;
string strFileName = FileUpload1.PostedFile.FileName;
Attachment attFilename = new Attachment(strFileName);
objEmail.Attachments.Add(attFilename);
SmtpClient smtpclient = new SmtpClient();
smtpclient.Send(objEmail);
For uploading purpose am using "FileUplaod control" and SMTP Server mention in webconfig.
Please Help me, Thanks in Advance
Regards,
Tekk
Reply
Answers (
0
)
Silverlight upload with progress bar but trigger server side event passing filename
selected DataGrid data is displayed in another control?