How to avoid error when creating SMTPClient from VB.NET

Pirie
Pirie used Ask the Experts™
on
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?
Dim smtpClient As SmtpClient = New SmtpClient(SMTP address, 25)

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
Use the .NET configuration utility to give permissions for creating and SMTP client to the application for particular users.

Author

Commented:
This was the clue that put me on the right track. I didn't even know of the existance of a .Net configuration utility.

Author

Commented:
This was the clue that put me on the right track. I didn't even know of the existance of a .Net configuration utility.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial