Dim sb As New StringBuilder()
Dim hWriter As New HtmlTextWriter(New StringWriter(sb))
MyBase.Render(hWriter)
Dim PageResult As String = sb.ToString()
writer.Write(PageResult)
Dim sPath() As String
sPath = System.IO.Directory.GetFiles(Server.MapPath("~\UploadedDocs"), "InvoicePrep" & Request.QueryString("ClientJobID") & ".html"
If sPath.Length > 0 Then
My.Computer.FileSystem.DeleteFile(sPath(0))
End If
Dim file As New System.IO.StreamWriter(Server.MapPath("~\UploadedDocs\") & "InvoicePrep" & Request.QueryString("ClientJobID") & ".html")
file.WriteLine(PageResult)
file.Close()
This is how it is working for me. Thanks to all of you for your response.