Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2007, 06:13 AM
Registered User
 
Join Date: Jan 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default About SmtpMail.Send() Method

Hi all,
This is Hari,
             In my application I need to generate a report for different people and send it through mail as attachment, and my approach to this task is I will generate a report for single person ,And send it to his Mail ID and then I will delete the report and generates next person’s report and send it.
             To send the report I am using SMTP server. I am able to send the mails if all the mail ids are correct, if the mail id of a person is incorrect in between I am able to handle the exception but I am not able to delete the report of that person the error I am getting is "Internal system error. Access to the path.... is denied."Even I am not able to delete the file manually .How can I come out of this please help me.



----------------------
Thank
[email protected]
 
Old February 5th, 2007, 01:00 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

I may be off here but why don't you check the mail id first before you create the report? Otherwise, you should be able to delete the file in the Finally of your Try/Catch. If you can't delete a file it probably has to do with your permissions in that directory.



 
Old February 5th, 2007, 02:59 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It sounds like the problem is that you have a class handling I/O on the file that is open when the error occurs.

You need to cleanup things before you try to delete the file. Put calls to .Close() methods and such in the finally block of the t/c/f and do the file deletion after that (could be in the finally{} as well). That way, even if the mail process fails, everything else will still happen without problems.

Also, you could wrap the mailing portion of the code in its own t/c/f.

-Peter
 
Old February 6th, 2007, 04:24 AM
Registered User
 
Join Date: Jan 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your replays,
     The problem is arising only when the email id is wrong ..
That means Smtpmail.send() method of my code is issuing lock on the file as the exception raised it is not releasing the lock I want know how to dispose MailMessage object in .Net 1.1
Please help me…….


----------------------
Thank
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
email without SmtpMail.Send method??? thomaz C# 3 April 1st, 2006 10:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.