Wininet Authentication Problem

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Wininet Authentication Problem

    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
    Jeffrey Cumpsty Guest

  2. Similar Questions and Discussions

    1. Authentication problem
      I have the following web method: <WebMethod()> _ Public Function Test_CurrentCredentials() As String() Dim tmpArr(2) As String tmpArr(0) =...
    2. web.config and authentication problem.
      Hello there! I have developed a .net web application. In which I am having some .aspx files and a web.config file. All the files are in same...
    3. Authentication IIS / ASP.NET - Problem
      1) I have an intranet . <Directory>Intranet with <Subdirctory>admin and <Subdirctory>database with an accessdatabase (data.mdb) I have 2...
    4. http authentication problem
      if ((!isset( $PHP_AUTH_USER )) || (!isset($PHP_AUTH_PW))) { header( 'WWW-Authenticate: Basic realm="Private"' ); header( 'HTTP/1.0 401...
    5. What problem is this (regarding Authentication Mode)?
      Server Error in '/' Application. ---------------------------------------------------------------------------- ---- Configuration Error...
  3. #2

    Default Re: Wininet Authentication Problem

    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" ?

    --
    feroze

    -----------------
    This posting is provided as-is. It offers no warranties and assigns no
    rights.

    See [url]http://weblogs.asp.net/feroze_daud[/url] for System.Net related posts.
    ----------------

    "Jeffrey Cumpsty" <jeff@cumpsty.co.uk> wrote in message
    news:648475e8.0501190632.6bc227f5@posting.google.c om...
    > 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

    Feroze [msft] Guest

  4. #3

    Default Wininet Authentication Problem

    Feroze,

    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


    Message 2 in thread
    From: Feroze [msft] (ferozed@online.microsoft.com)
    Subject: Re: Wininet Authentication Problem


    View this article only
    Newsgroups: microsoft.public.dotnet.framework.aspnet.security,
    microsoft.public.inetserver.iis.security, microsoft.public.winhttp,
    microsoft.public.inetsdk.programming.wininet
    Date: 2005-01-20 17:53:34 PST


    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" ?

    --
    feroze
    Jeffrey Cumpsty Guest

  5. #4

    Default Re: Wininet Authentication Problem

    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





    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Jeffrey Cumpsty Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139