Weird problem with files deltion using wininet HTTP and ASP vbscript 
Author Message
 Weird problem with files deltion using wininet HTTP and ASP vbscript

Sorry for the cross post but it touches two groups so :-)

Simplified snippet of VB code follows this is in a procedure in an
application:
It issues an Http request to an asp page, the page is then supposed to
delete the files.

   hInternetSession = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT,
vbNullString, vbNullString, 0)

    If CBool(hInternetSession) Then
        g_website = " http://www.*-*-*.com/ ;
ternetConnect = InternetConnect(hInternetSession, g_website,
INTERNET_DEFAULT_HTTP_PORT, _
                           vbNullString, vbNullString,
INTERNET_SERVICE_HTTP, 0, 0)
        If hInternetConnect > 0 Then
            GetRequest = "Files=abcdef"
These are the files that must be deleted (4 of them starting with abcdef)

            hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET",
GetRequest, "HTTP/1.0", vbNullString, 0, _
                               INTERNET_FLAG_RELOAD, 0)
            If CBool(hHttpOpenRequest) Then
                iRetval = HttpSendRequest(hHttpOpenRequest, vbNullString, 0,
0, 0)
                If iRetval Then
                    'Should indicate success
                End If
            End If
        End If
    End If

When this request gets to the asp page there is VBScript using the file
system object that deletes the files
starting with name abcdef, there are 4 files one with extension. txt.
another with .mdb, another with .mdz and finally one with .eot

The Asp code snippet is:

Filename = request.querystring("Files")
MyFSO = CreateObject("scripting.filesystemobject")
MyFso.deleteFile "F:\" & Filename & ".txt"
MyFso.deleteFile "F:\" & Filename & ".mdb"
MyFso.deleteFile "F:\" & Filename & ".mdz"
MyFso.deleteFile "F:\" & Filename & ".eot"

When the asp code gets executed from a browser by issuing the command
http://www.*-*-*.com/
deleted OK.
However issuing the same http request through the wininet.dll code above and
the file with extension .txt does not get deleted nor does the file with
extension .mdz although the other two get deleted OK.

Totally weird. Anyone seen anything like it and have a solution?
I tried changing the asp page to delete one specific file at at time so I
specify the full filename and the extension in the get request and repeat
the whole procedure with a new connection for each file. The same two files
still don't get deleted. Evidently my code does not trap any return messages
from the IIS server.

I was also wondering what Wininet call to add so that I can see what the
server returns after the get request is issued.

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com



Mon, 18 Nov 2002 03:00:00 GMT  
 Weird problem with files deltion using wininet HTTP and ASP vbscript
The files that can't be deleted are files that were just downloaded
previously by the same app using an HTTP get request using wininet.dll.
If I make  small quick app that just runs the deletion code, then run the
app that does the download, close it and do the delete with the app that
only deletes , the files get deleted OK.
It looks like the first application that downloads does not close the
internet connection although after each file transfer I issue an
InternetClosehandle command.

Is there another command that ensures an internet session is closed?

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com

Quote:
> Sorry for the cross post but it touches two groups so :-)

> Simplified snippet of VB code follows this is in a procedure in an
> application:
> It issues an Http request to an asp page, the page is then supposed to
> delete the files.

>    hInternetSession = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT,
> vbNullString, vbNullString, 0)

>     If CBool(hInternetSession) Then
>         g_website = "http://www.myweb.com/myasppage.asp"
> ternetConnect = InternetConnect(hInternetSession, g_website,
> INTERNET_DEFAULT_HTTP_PORT, _
>                            vbNullString, vbNullString,
> INTERNET_SERVICE_HTTP, 0, 0)
>         If hInternetConnect > 0 Then
>             GetRequest = "Files=abcdef"
> These are the files that must be deleted (4 of them starting with abcdef)

>             hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET",
> GetRequest, "HTTP/1.0", vbNullString, 0, _
>                                INTERNET_FLAG_RELOAD, 0)
>             If CBool(hHttpOpenRequest) Then
>                 iRetval = HttpSendRequest(hHttpOpenRequest, vbNullString,
0,
> 0, 0)
>                 If iRetval Then
>                     'Should indicate success
>                 End If
>             End If
>         End If
>     End If

> When this request gets to the asp page there is Vbscript using the file
> system object that deletes the files
> starting with name abcdef, there are 4 files one with extension. txt.
> another with .mdb, another with .mdz and finally one with .eot

> The Asp code snippet is:

> Filename = request.querystring("Files")
> MyFSO = CreateObject("scripting.filesystemobject")
> MyFso.deleteFile "F:\" & Filename & ".txt"
> MyFso.deleteFile "F:\" & Filename & ".mdb"
> MyFso.deleteFile "F:\" & Filename & ".mdz"
> MyFso.deleteFile "F:\" & Filename & ".eot"

> When the asp code gets executed from a browser by issuing the command
> http://www.myweb.com/myasppage.asp?Files=abcdef all four files will get
> deleted OK.
> However issuing the same http request through the wininet.dll code above
and
> the file with extension .txt does not get deleted nor does the file with
> extension .mdz although the other two get deleted OK.

> Totally weird. Anyone seen anything like it and have a solution?
> I tried changing the asp page to delete one specific file at at time so I
> specify the full filename and the extension in the get request and repeat
> the whole procedure with a new connection for each file. The same two
files
> still don't get deleted. Evidently my code does not trap any return
messages
> from the IIS server.

> I was also wondering what Wininet call to add so that I can see what the
> server returns after the get request is issued.

> --
> Robert Dufour, MCP, MCT
> President SGI IMS Inc.
> www.sgiims.com



Mon, 18 Nov 2002 03:00:00 GMT  
 Weird problem with files deltion using wininet HTTP and ASP vbscript
It *may* be IIS file handle caching...

Q191742 - IIS: Access Denied When Trying to Update Files on IIS Computer
http://support.microsoft.com/support/kb/articles/q191/7/42.asp

See the other KB articles listed in "More Information"l...

--
Michael Harris
MVP Scripting

The files that can't be deleted are files that were just downloaded
previously by the same app using an HTTP get request using wininet.dll.
If I make  small quick app that just runs the deletion code, then run the
app that does the download, close it and do the delete with the app that
only deletes , the files get deleted OK.
It looks like the first application that downloads does not close the
internet connection although after each file transfer I issue an
InternetClosehandle command.

Is there another command that ensures an internet session is closed?

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com

Quote:
> Sorry for the cross post but it touches two groups so :-)

> Simplified snippet of VB code follows this is in a procedure in an
> application:
> It issues an Http request to an asp page, the page is then supposed to
> delete the files.

>    hInternetSession = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT,
> vbNullString, vbNullString, 0)

>     If CBool(hInternetSession) Then
>         g_website = "http://www.myweb.com/myasppage.asp"
> ternetConnect = InternetConnect(hInternetSession, g_website,
> INTERNET_DEFAULT_HTTP_PORT, _
>                            vbNullString, vbNullString,
> INTERNET_SERVICE_HTTP, 0, 0)
>         If hInternetConnect > 0 Then
>             GetRequest = "Files=abcdef"
> These are the files that must be deleted (4 of them starting with abcdef)

>             hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET",
> GetRequest, "HTTP/1.0", vbNullString, 0, _
>                                INTERNET_FLAG_RELOAD, 0)
>             If CBool(hHttpOpenRequest) Then
>                 iRetval = HttpSendRequest(hHttpOpenRequest, vbNullString,
0,
> 0, 0)
>                 If iRetval Then
>                     'Should indicate success
>                 End If
>             End If
>         End If
>     End If

> When this request gets to the asp page there is Vbscript using the file
> system object that deletes the files
> starting with name abcdef, there are 4 files one with extension. txt.
> another with .mdb, another with .mdz and finally one with .eot

> The Asp code snippet is:

> Filename = request.querystring("Files")
> MyFSO = CreateObject("scripting.filesystemobject")
> MyFso.deleteFile "F:\" & Filename & ".txt"
> MyFso.deleteFile "F:\" & Filename & ".mdb"
> MyFso.deleteFile "F:\" & Filename & ".mdz"
> MyFso.deleteFile "F:\" & Filename & ".eot"

> When the asp code gets executed from a browser by issuing the command
> http://www.myweb.com/myasppage.asp?Files=abcdef all four files will get
> deleted OK.
> However issuing the same http request through the wininet.dll code above
and
> the file with extension .txt does not get deleted nor does the file with
> extension .mdz although the other two get deleted OK.

> Totally weird. Anyone seen anything like it and have a solution?
> I tried changing the asp page to delete one specific file at at time so I
> specify the full filename and the extension in the get request and repeat
> the whole procedure with a new connection for each file. The same two
files
> still don't get deleted. Evidently my code does not trap any return
messages
> from the IIS server.

> I was also wondering what Wininet call to add so that I can see what the
> server returns after the get request is issued.

> --
> Robert Dufour, MCP, MCT
> President SGI IMS Inc.
> www.sgiims.com



Mon, 18 Nov 2002 03:00:00 GMT  
 Weird problem with files deltion using wininet HTTP and ASP vbscript
We went through all the articles, applied the fix to remove caching on the
IIS server machine. It still exhibits the same behaviour. The only way we
found for a workaround was to create a vb app that gets started
automatically every two hours or so and that deletes the files that are more
than 2 hours old in that subdirectory. It's a patch that works fine, but
there's no valid reason why our original concept should not work. Another
mystery.

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com

Quote:
> It *may* be IIS file handle caching...

> Q191742 - IIS: Access Denied When Trying to Update Files on IIS Computer
> http://support.microsoft.com/support/kb/articles/q191/7/42.asp

> See the other KB articles listed in "More Information"l...

> --
> Michael Harris
> MVP Scripting




Quote:
> The files that can't be deleted are files that were just downloaded
> previously by the same app using an HTTP get request using wininet.dll.
> If I make  small quick app that just runs the deletion code, then run the
> app that does the download, close it and do the delete with the app that
> only deletes , the files get deleted OK.
> It looks like the first application that downloads does not close the
> internet connection although after each file transfer I issue an
> InternetClosehandle command.

> Is there another command that ensures an internet session is closed?

> --
> Robert Dufour, MCP, MCT
> President SGI IMS Inc.
> www.sgiims.com


> > Sorry for the cross post but it touches two groups so :-)

> > Simplified snippet of VB code follows this is in a procedure in an
> > application:
> > It issues an Http request to an asp page, the page is then supposed to
> > delete the files.

> >    hInternetSession = InternetOpen(scUserAgent,

INTERNET_OPEN_TYPE_DIRECT,

- Show quoted text -

Quote:
> > vbNullString, vbNullString, 0)

> >     If CBool(hInternetSession) Then
> >         g_website = "http://www.myweb.com/myasppage.asp"
> > ternetConnect = InternetConnect(hInternetSession, g_website,
> > INTERNET_DEFAULT_HTTP_PORT, _
> >                            vbNullString, vbNullString,
> > INTERNET_SERVICE_HTTP, 0, 0)
> >         If hInternetConnect > 0 Then
> >             GetRequest = "Files=abcdef"
> > These are the files that must be deleted (4 of them starting with
abcdef)

> >             hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "GET",
> > GetRequest, "HTTP/1.0", vbNullString, 0, _
> >                                INTERNET_FLAG_RELOAD, 0)
> >             If CBool(hHttpOpenRequest) Then
> >                 iRetval = HttpSendRequest(hHttpOpenRequest,
vbNullString,
> 0,
> > 0, 0)
> >                 If iRetval Then
> >                     'Should indicate success
> >                 End If
> >             End If
> >         End If
> >     End If

> > When this request gets to the asp page there is Vbscript using the file
> > system object that deletes the files
> > starting with name abcdef, there are 4 files one with extension. txt.
> > another with .mdb, another with .mdz and finally one with .eot

> > The Asp code snippet is:

> > Filename = request.querystring("Files")
> > MyFSO = CreateObject("scripting.filesystemobject")
> > MyFso.deleteFile "F:\" & Filename & ".txt"
> > MyFso.deleteFile "F:\" & Filename & ".mdb"
> > MyFso.deleteFile "F:\" & Filename & ".mdz"
> > MyFso.deleteFile "F:\" & Filename & ".eot"

> > When the asp code gets executed from a browser by issuing the command
> > http://www.myweb.com/myasppage.asp?Files=abcdef all four files will get
> > deleted OK.
> > However issuing the same http request through the wininet.dll code above
> and
> > the file with extension .txt does not get deleted nor does the file with
> > extension .mdz although the other two get deleted OK.

> > Totally weird. Anyone seen anything like it and have a solution?
> > I tried changing the asp page to delete one specific file at at time so
I
> > specify the full filename and the extension in the get request and
repeat
> > the whole procedure with a new connection for each file. The same two
> files
> > still don't get deleted. Evidently my code does not trap any return
> messages
> > from the IIS server.

> > I was also wondering what Wininet call to add so that I can see what the
> > server returns after the get request is issued.

> > --
> > Robert Dufour, MCP, MCT
> > President SGI IMS Inc.
> > www.sgiims.com



Sat, 23 Nov 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. WININET DLL USING HTTP GET TO DOWNLOAD BINARY FILES

2. Uploading Files through HTTP Using Wininet

3. Using Wininet to retrieve binary files over HTTP?

4. File upload from VB 6 to ASP file using http form post

5. POST variables not passed using WININET/ASP

6. Get dir structure from HTTP address using WinInet

7. Get dir structure from HTTP address using WinInet

8. HTTP Request using WinInet

9. HTTP Post using WinInet.DLL

10. Using wininet.dll with HTTP

11. HTTP Certificates using wininet.dll

12. All HTTP/FTP/Gopher problems solved WININET.DLL continued

 

 
Powered by phpBB® Forum Software