Pirie
asked on
How to avoid error when creating SMTPClient from VB.NET
Hi,
I've written a simple VB.NET program to send an eMail. Part of the code creates the smtpClient using the following code:
Dim smtpClient As SmtpClient = New SmtpClient(SMTP address, 25)
The program works well if I run it from my local disk and the eMail is correctly sent to the given address.
On the other hand, if I run the program on our internal LAN, I get the following error message when it tries to create the client and the eMail doesn't get sent:
"Request for permission of type 'System.Net.SmtpPermission , System, Version=2.0.0.0' failed".
I suppose that our Network Manager should change a setting for certain priveleged users (i.e. those allowed to send an eMail from my program). Can anybody suggest which setting should be changed?
I've written a simple VB.NET program to send an eMail. Part of the code creates the smtpClient using the following code:
Dim smtpClient As SmtpClient = New SmtpClient(SMTP address, 25)
The program works well if I run it from my local disk and the eMail is correctly sent to the given address.
On the other hand, if I run the program on our internal LAN, I get the following error message when it tries to create the client and the eMail doesn't get sent:
"Request for permission of type 'System.Net.SmtpPermission
I suppose that our Network Manager should change a setting for certain priveleged users (i.e. those allowed to send an eMail from my program). Can anybody suggest which setting should be changed?
Dim smtpClient As SmtpClient = New SmtpClient(SMTP address, 25)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This was the clue that put me on the right track. I didn't even know of the existance of a .Net configuration utility.
ASKER