suguna12

suguna12

  • NA
  • 1
  • 0

send email using VB.NET windows form

Nov 28 2006 5:11 PM

Hi,

I have created a windows Application using vb.net.
sending email when click on button. Working fine when running the application on the server machine but I am having error when running from my machine.

Using this code:

    Try
            Dim email As New System.Web.Mail.MailMessage
            email.To = "tomail"
            email.From = "frommail"
            email.Body = "MessageText"
            email.Subject = "SubjectText"
            email.BodyFormat = Web.Mail.MailFormat.Text
            SmtpMail.SmtpServer = "MU-WEBDEV"
            SmtpMail.Send(email)
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try

I am getting the following error.


An unhandled exception of type 'System.Security.SecurityException' occurred in ICP.exe

Additional information: Request for the permission of type System.Web.AspNetHostingPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

Can any one help me with this please. its urgent.

Thanks.


Answers (1)