Saturday, March 24, 2012

SmtpMail

Hi. I have the following code which sends an e-mail from my asp.net
application. This works fine on my localhost, but when I run this from the
server I get an "Access Denied" Message. What do I need to do to run this
successfully from my server? Thanks.
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSend.Click
Dim MsgFrom As String = "someone@dotnet.itags.org.abc.com"
Dim MsgTo As String = "someone@dotnet.itags.org.def.com"
Dim MsgBody As String = Me.txtBody.Text & " " &
Request.QueryString("SupportInfo")
SmtpMail.Send(MsgFrom.Trim, MsgTo.Trim, Me.txtSubject.Text.Trim, _
MsgBody.Trim)
End Sub
Error:
ASP.NET is not authorized to access the requested resource. Consider
granting access rights to the resource to the ASP.NET request identity.
ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
Network Service on IIS 6) that is used if the application is not
impersonating. If the application is impersonating via <identity
impersonate="true"/>, the identity will be the anonymous user (typically
IUSR_MACHINENAME) or the authenticated request user.the user that the site runs under needs access to the smtp folders
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"MrMike" <MrMike@.discussions.microsoft.com> wrote in message
news:415B23E2-D802-4474-93F6-A000D3A518DF@.microsoft.com...
> Hi. I have the following code which sends an e-mail from my asp.net
> application. This works fine on my localhost, but when I run this from
> the
> server I get an "Access Denied" Message. What do I need to do to run this
> successfully from my server? Thanks.
> Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnSend.Click
> Dim MsgFrom As String = "someone@.abc.com"
> Dim MsgTo As String = "someone@.def.com"
> Dim MsgBody As String = Me.txtBody.Text & " " &
> Request.QueryString("SupportInfo")
> SmtpMail.Send(MsgFrom.Trim, MsgTo.Trim, Me.txtSubject.Text.Trim, _
> MsgBody.Trim)
> End Sub
>
> Error:
> ASP.NET is not authorized to access the requested resource. Consider
> granting access rights to the resource to the ASP.NET request identity.
> ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
> or
> Network Service on IIS 6) that is used if the application is not
> impersonating. If the application is impersonating via <identity
> impersonate="true"/>, the identity will be the anonymous user (typically
> IUSR_MACHINENAME) or the authenticated request user.
Curt_C, What folders exactly are you refering to? Where would these folders
be located? Thanks for your help!
"Curt_C [MVP]" wrote:

> the user that the site runs under needs access to the smtp folders
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> Site: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
> "MrMike" <MrMike@.discussions.microsoft.com> wrote in message
> news:415B23E2-D802-4474-93F6-A000D3A518DF@.microsoft.com...
>
>
they are on the server in the MailRoot, under the InetPub
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"MrMike" <MrMike@.discussions.microsoft.com> wrote in message
news:0C3EBFBA-7149-4545-A5CF-0DC28F2DAF4C@.microsoft.com...
> Curt_C, What folders exactly are you refering to? Where would these
> folders
> be located? Thanks for your help!
> "Curt_C [MVP]" wrote:
>
Actually I've verified that the permissions were in place, and I've found
that the problem was that I needed to specify
SMTPMail.SMPTServer = "Server IP Address"
Thanks for your help.
"Curt_C [MVP]" wrote:

> they are on the server in the MailRoot, under the InetPub
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> Site: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
> "MrMike" <MrMike@.discussions.microsoft.com> wrote in message
> news:0C3EBFBA-7149-4545-A5CF-0DC28F2DAF4C@.microsoft.com...
>
>

0 comments:

Post a Comment