p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

asp_forms thread: How to close DSOlefile object in ASPX

Message #1 by "dean kramaric" <dkram@t...> on Tue, 5 Feb 2002 07:50:42
Hi all,


I'm stuck trying to resolve this problem and if anyone has a suggestion I 

would greatly appreciate.


Here's what I'm trying to do: 

- Upload Word file to a web server and display metatag properties in aspx 

page (no problem with this)

- Allow users to change some fields and save the changes back to the file 

(works sometimes, but getting "The file is currently open and cannot be 

read" error)

obj=Nothing does not seem to work.  Is there a faster/better way to 

destroy objects in asp.net?


Public filename As String

Sub Page_Load(Sender As Object, E As EventArgs)

  dim filename = Request.Params("file")

 If Not (Page.IsPostBack)


 dim objPropReader = CreateObject("DSOLEFILE.PropertyReader")

 dim objFileProps= objPropReader.GetDocumentProperties(filename)


   custPRauthor = objFileProps.CustomProperties.Item("Created By")




    objFileProps = Nothing

   objPropReader = Nothing   



//  this part sometimes works, sometimes gives the file access error

  dim obj2PropReader = CreateObject("DSOLEFILE.PropertyReader")

  dim obj2FileProps= obj2PropReader.GetDocumentProperties(filename)// 

Error: file cannot be read


   obj2FileProps.CustomProperties.Item("Created By").Value=author.Text



   obj2FileProps = Nothing

   obj2PropReader = Nothing

   End If


//File stays locked after the page closes



  Return to Index