Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: How to close DSOlefile object in ASPX


Message #1 by "Dejan Kramaric" <dkram@t...> on Mon, 4 Feb 2002 23:27:37 -0800
This is a multi-part message in MIME format.



------=_NextPart_000_000C_01C1ADD3.884EE0E0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



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=3DNothing 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 =3D Request.Params("file")



 If Not (Page.IsPostBack)

  

 dim objPropReader =3D CreateObject("DSOLEFILE.PropertyReader")

 dim objFileProps=3D objPropReader.GetDocumentProperties(filename)

       

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

   ~~ 

   ~~

  

    objFileProps =3D Nothing

   objPropReader =3D Nothing  



Else

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



  dim obj2PropReader =3D CreateObject("DSOLEFILE.PropertyReader")

  dim obj2FileProps=3D obj2PropReader.GetDocumentProperties(filename)// 

Error: file cannot be read

    

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

    ~~

   ~~

   obj2FileProps =3D Nothing

   obj2PropReader =3D Nothing

   End If



//File stays locked after the page closes



Dean









  Return to Index