N
Nathan Sokalski
I am using an *.aspx page with a querystring to access graphics that I am
using in rollovers. I am using Response.ContentType and using
Response.WriteFile(). This sends the graphic perfectly fine, and in most
cases would work perfect. However, there are situations that I am running
into in which I want to delete the graphic file. When I try to do this, even
if a different rollover was the last one to use the page, I recieve a "The
process cannot access the file because it is being used by another process."
error. Is there something else I need to do? Here is my code:
Partial Public Class FileReader : Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim filepath As String = Request.QueryString("filepath").Replace("|"c,
"\"c)
Dim mimetype As String =
My.Computer.Registry.ClassesRoot.OpenSubKey(My.Computer.FileSystem.GetFileInfo(filepath).Extension).GetValue("Content
Type").ToString().ToLower()
Response.ClearContent()
Response.ContentType = mimetype
Response.WriteFile(filepath)
Response.End()
End Sub
End Class
I appreciate any help possible. Thanks.
using in rollovers. I am using Response.ContentType and using
Response.WriteFile(). This sends the graphic perfectly fine, and in most
cases would work perfect. However, there are situations that I am running
into in which I want to delete the graphic file. When I try to do this, even
if a different rollover was the last one to use the page, I recieve a "The
process cannot access the file because it is being used by another process."
error. Is there something else I need to do? Here is my code:
Partial Public Class FileReader : Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim filepath As String = Request.QueryString("filepath").Replace("|"c,
"\"c)
Dim mimetype As String =
My.Computer.Registry.ClassesRoot.OpenSubKey(My.Computer.FileSystem.GetFileInfo(filepath).Extension).GetValue("Content
Type").ToString().ToLower()
Response.ClearContent()
Response.ContentType = mimetype
Response.WriteFile(filepath)
Response.End()
End Sub
End Class
I appreciate any help possible. Thanks.