I'm getting this error if I try to use system.mail.web in code. Does this mean my code is bad or that I can't use
I added the system.web.dll as a reference and I put
Imports System.Web.Mail at the top of the program....what am i missing?
code:........................
Dim mail As New MailMessage
mail.To = "
[email protected]"
mail.From = "
[email protected]"
mail.Subject = "this is a test email."
mail.Body = "this is my test email body"
'SmtpMail.SmtpServer = "localhost" 'your real server goes here
SmtpMail.Send(mail)
Error........................
System.Security.SecurityException
Request for the permission of type System.Web.AspNetHostingPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at InfoPathProject2.InfoPathProject2.CTRL1_5_OnClick(DocActionEvent e)
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)