Wininet Authentication Problem

J

Jeffrey Cumpsty

Can anyone help?

We have an internal web application which uses a proxy to handle user
authentication.

Sessions, and Authentication are handles by a client side cookie.

I have a requirement to download files from the server to the client
and process them with data (they are word documents).

THe application works fine outside the authenticated environment, but
once the security is put into it, I can not access my download
scripts.

Server side code is asp.net, C#. Client side has to be VB6, and is
presently using Wininet.dll.

Does anyone know how I can get the session from the web page, and pass
it into the VB6 ActiveX Control that resides on it?

Regards
Jeff Cumpsty
 
F

Feroze [msft]

Can you give more detail on what exactly the configuration is? I am assuming
that you have a VB6 client using Wininet, to communicate with a server. The
server side is written in asp.net/c#. It seems as if you want to pass some
information into the vb6 control, which resides on the webapp.

So, what problems are you having when you turn on security? WHat do you mean
by "turning on security" ?
 
J

Jeffrey Cumpsty

You are right about the setup. We have an ASP.Net/C# web server,
which is accessed through a proxy to handle the login for multiple
portals.

State is maintained through the MS Application Block.

Since this is a large company, they have an upgade path for the client
PC's, but currently we can not guarantee that the .Net framework is on
there. All we can guarantee is IE4, Office 97, and VB6 runtimes.
Because of this my client code needs to be in a VB6 Active X Control.

I was going to develop the solution using iFrames to maintain the
session. However I thought using Wininet API calls directly was the
better option.

It works great on my local PC, because there is no authentication
requirement. However when I copy the code over to the production web
server, every call I make is being redirected to the Login Page. My
call to InternetReadFile returns the HTML for this page, not the XML
and data that should be streamed via http.

Thanks in advance for any help.

Regards
Jeff Cumpsty

here is my function to get the data from the url...

Private Function InternetCallBack(ByVal url As String, ByRef ctrl As
LettersClientCtrl) As String
Const FUNCTIONNAME As String = "InternetCallBack"

On Error GoTo Err_Handler

Dim hOpen As Long
Dim hOpenUrl As Long
Dim sUrl As String
Dim bDoLoop As Boolean
Dim bRet As Boolean
Dim sReadBuffer As String * 2048
Dim lNumberOfBytesRead As Long
Dim sBuffer As String
Dim file As String

' determine the url to call.
sUrl = url

' Open a connection to the server.
hOpen = InternetOpenAPI(scUserAgent, INTERNET_OPEN_TYPE_PRECONFIG,
vbNullString, vbNullString, 0)
If hOpen = 0 Then
Exit Function
End If

' Open a connection to the server side processing page.
hOpenUrl = InternetOpenUrlAPI(hOpen, sUrl, vbNullString, 0,
INTERNET_FLAG_RELOAD, 0)
If hOpenUrl = 0 Then
Exit Function
End If

bDoLoop = True

' Get file size
While bDoLoop
bRet = InternetReadFileAPI(hOpenUrl, sReadBuffer, 1,
lNumberOfBytesRead)
If (Left$(sReadBuffer, 1) = "#") Then
bDoLoop = False
Else
file = file & Left$(sReadBuffer, 1)
End If
ctrl.ChangeProgress
Wend

' Download the file from the server.
bDoLoop = True
While bDoLoop
sReadBuffer = vbNullString
bRet = InternetReadFileAPI(hOpenUrl, sReadBuffer,
Len(sReadBuffer), lNumberOfBytesRead)
sBuffer = sBuffer & Left$(sReadBuffer, lNumberOfBytesRead)
ctrl.ChangeProgress
If Not CBool(lNumberOfBytesRead) Then
bDoLoop = False
End If
Wend

If hOpenUrl <> 0 Then InternetCloseHandleAPI (hOpenUrl)
If hOpen <> 0 Then InternetCloseHandleAPI (hOpen)

' return the buffer to the calling routine. It can process it as
needed.
InternetCallBack = sBuffer

Exit Function

Err_Handler:
If hOpenUrl <> 0 Then InternetCloseHandleAPI (hOpenUrl)
If hOpen <> 0 Then InternetCloseHandleAPI (hOpen)
Err.Raise Err.Number, ErrorSource(Err.Source, FUNCTIONNAME,
MODULENAME)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top