Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
when i am trying to send email through my asp.net web application the follwing error occured

Please help me
i am using Host as "localhost" and Port is 25


XML
Server Error in '/ASPBangalore' Application.

Access to the path 'C:\inetpub\Pickup\e7b32ca4-0a8a-48b3-a15d-da7aaa15edff.eml' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\inetpub\Pickup\e7b32ca4-0a8a-48b3-a15d-da7aaa15edff.eml' is denied.

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 and IIS 7, and the configured application pool identity on IIS 7.5) 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.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[UnauthorizedAccessException: Access to the path 'C:\inetpub\Pickup\e7b32ca4-0a8a-48b3-a15d-da7aaa15edff.eml' is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12901895
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +2481
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +229
   System.IO.FileStream..ctor(String path, FileMode mode) +106
   System.Net.Mail.SmtpClient.GetFileMailWriter(String pickupDirectory) +393
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1424

[SmtpException: Failure sending mail.]
   System.Net.Mail.SmtpClient.Send(MailMessage message) +2187367
   SMTP.btnSend_Click(Object sender, EventArgs e) +307
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1008
Posted
Updated 5-Sep-13 20:05pm
v2
Comments
KmgKrishnan 6-Sep-13 3:20am    
Hi, Stack trace clearly says that it's an access issue to the user account using which you are trying to send email. Is this happening only for email or occurring for any other functionalities?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900