HighTechTalks DotNet Forums  

Error when sending a graphic by setting Response.ContentType

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Error when sending a graphic by setting Response.ContentType in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nathan Sokalski
 
Posts: n/a

Default Error when sending a graphic by setting Response.ContentType - 12-18-2007 , 09:56 AM






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.Com puter.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.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.