Click here to Skip to main content
16,004,969 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Monthname() function Pin
Prateek G28-Nov-07 1:06
Prateek G28-Nov-07 1:06 
GeneralRe: Monthname() function Pin
thuyaaung728-Nov-07 1:38
thuyaaung728-Nov-07 1:38 
QuestionHandling Excel Files... Pin
pavya_Cool27-Nov-07 21:02
pavya_Cool27-Nov-07 21:02 
AnswerRe: Handling Excel Files... Pin
Prateek G27-Nov-07 21:13
Prateek G27-Nov-07 21:13 
GeneralRe: Handling Excel Files... Pin
Prateek G27-Nov-07 21:17
Prateek G27-Nov-07 21:17 
QuestionCan we access Session from asp to asp.net Pin
NetBot27-Nov-07 20:47
NetBot27-Nov-07 20:47 
AnswerRe: Can we access Session from asp to asp.net Pin
_AK_27-Nov-07 21:44
_AK_27-Nov-07 21:44 
QuestionProblem deleting mail attachment Pin
NetBot27-Nov-07 20:39
NetBot27-Nov-07 20:39 
Hi all,

i m sending mails using Asp.net 2.0
Here is my code

Sub SendMail()
Dim msg As New MailMessage()
Dim attach_file1 As String = String.Empty
Dim strfilename As String = String.Empty
Dim strpath As String = Request.ApplicationPath & "/" & "Attachments" & "/"
strfilename = Path.GetFileName(UploadCV.PostedFile.FileName)
UploadCV.PostedFile.SaveAs(Server.MapPath(strpath & strfilename))
Dim attach As New Attachment(Server.MapPath(strpath & strfilename))
msg.Attachments.Add(attach)
attach_file1 = strfilename
Dim smtpclnt As New SmtpClient()
Dim ds1 As New DataSet()
ds1 = CType(Session("Dataset"), DataSet)
msg.Subject = "You have successfully applied for the post of " & ds1.Tables(0).Rows(0).Item(2).ToString()
msg.Body = "Hi all"
'msg.To.Add(ds1.Tables(0).Rows(0).Item(9))
msg.To.Add("somemail@gmail.com")
msg.From = New MailAddress(Session("emailid").ToString())
smtpclnt.Send(msg)
If attach_file1 <> "" Then
File.Delete(Server.MapPath(strpath & strfilename))
End If
End Sub

but it gives me exception at
File.Delete(Server.MapPath(strpath & strfilename))
and it says
The process cannot access the file (filepath) because it is being used by another process.

any idea abt this error?

modified on Sunday, July 17, 2011 2:38 PM

QuestionPlease I need your help in asp.net Pin
abglorie27-Nov-07 20:14
abglorie27-Nov-07 20:14 
AnswerRe: Please I need your help in asp.net Pin
AS@1327-Nov-07 20:23
AS@1327-Nov-07 20:23 
GeneralRe: Please I need your help in asp.net Pin
abglorie27-Nov-07 22:19
abglorie27-Nov-07 22:19 
AnswerRe: Please I need your help in asp.net Pin
Prateek G27-Nov-07 21:19
Prateek G27-Nov-07 21:19 
AnswerRe: Please I need your help in asp.net Pin
Vasudevan Deepak Kumar27-Nov-07 21:30
Vasudevan Deepak Kumar27-Nov-07 21:30 
AnswerRe: Please I need your help in asp.net Pin
Anusubha.V.G28-Nov-07 0:44
Anusubha.V.G28-Nov-07 0:44 
AnswerForum Guidelines Pin
leckey28-Nov-07 4:31
leckey28-Nov-07 4:31 
QuestionURL Rewriting Pin
Jintal Patel27-Nov-07 20:00
Jintal Patel27-Nov-07 20:00 
Questionview in Excel Pin
niki_nilu27-Nov-07 19:48
niki_nilu27-Nov-07 19:48 
GeneralRe: view in Excel Pin
AS@1327-Nov-07 20:02
AS@1327-Nov-07 20:02 
GeneralRe: view in Excel Pin
niki_nilu27-Nov-07 22:03
niki_nilu27-Nov-07 22:03 
GeneralRe: view in Excel Pin
Prateek G27-Nov-07 22:10
Prateek G27-Nov-07 22:10 
GeneralRe: view in Excel Pin
niki_nilu27-Nov-07 23:57
niki_nilu27-Nov-07 23:57 
GeneralRe: view in Excel Pin
niki_nilu28-Nov-07 1:03
niki_nilu28-Nov-07 1:03 
GeneralRe: view in Excel Pin
Prateek G28-Nov-07 1:10
Prateek G28-Nov-07 1:10 
GeneralRe: view in Excel Pin
Prateek G28-Nov-07 1:15
Prateek G28-Nov-07 1:15 
GeneralRe: view in Excel Pin
niki_nilu29-Nov-07 20:07
niki_nilu29-Nov-07 20:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.