I thought I could just copy over some asp.net code like:
System.Web.Mail.MailMessage mailMessage =new System.Web.Mail.MailMessage();
But VS2005 doesn't seem to want me touching System.Web.Mail.
Any ideas?
Thanks,
Allen
OK, I figured out that I need to useSystem.Net.Mail, but here is the next problem- when I create an instance of the SmtpClient object like this:
SmtpClient
client =newSmtpClient("localhost",25);I get this exception:System.Security.SecurityException: Requestfor the permissionof type'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.System.Security.SecurityException: at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Mail.SmtpClient.Initialize() at System.Net.Mail.SmtpClient..ctor(String host, Int32 port)|||
has anyone managed to solve this one?
am getting the same error...
|||I was able to get around that error (and a few others) by doing the following:
ALTER DATABASE [PUBS]SET TRUSTWORTHYONGOALTER ASSEMBLY [TaskScheduler]WITH PERMISSION_SET = UNSAFE
I hope this helps.
-Allen Cryer
|||I was able to get around that error (and a few others) by doing the following:
ALTER DATABASE [PUBS]SET TRUSTWORTHYONGOALTER ASSEMBLY [TaskScheduler]WITH PERMISSION_SET = UNSAFE
I hope this helps.
-Allen Cryer
|||mate,you're a champ.I've looked for the last 24 hours all over.Thank you very much. Works like a charm now.
No comments:
Post a Comment