vb.net and autoproxy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Moss

    vb.net and autoproxy

    This seemed so easy at the beginning...

    I have a need to use xml data from a web server inside a vb.net program.
    During development it worked great - then came the real world.

    Some of the people who will use my application use autoproxy.
    They cannot access the web server directly, nor do they have proxy
    server information hard coded in their registries.

    Oh, and I'm using the .net 1.1 runtime (Visual Studio .net 2003)

    Does anyone know how to get out through a web proxy, determined by
    autoproxy, in vb.net and the 1.1 .net runtime?

    --
    DM
    personal opinion only
  • Jan Hyde

    #2
    Re: vb.net and autoproxy

    David Moss <q0320811@mail. connect.usq.edu .au>'s wild
    thoughts were released on Sun, 02 Apr 2006 00:25:05 GMT
    bearing the following fruit:
    [color=blue]
    >This seemed so easy at the beginning...
    >
    >I have a need to use xml data from a web server inside a vb.net program.
    >During development it worked great - then came the real world.
    >
    >Some of the people who will use my application use autoproxy.
    >They cannot access the web server directly, nor do they have proxy
    >server information hard coded in their registries.
    >
    >Oh, and I'm using the .net 1.1 runtime (Visual Studio .net 2003)
    >
    >Does anyone know how to get out through a web proxy, determined by
    >autoproxy, in vb.net and the 1.1 .net runtime?[/color]

    You need to ask in a dotnet group, this one if for VB6



    Jan Hyde (VB MVP)

    --
    When ancient wall sculptors were finished, it was a relief. (David Kahn)

    Comment

    • David Moss

      #3
      Re: vb.net and autoproxy

      In article <73c432dohq9dsk l1hi7ihlsa90t1q kj0a4@4ax.com>,
      StellaDrinker@R EMOVE.ME.uboot. com writes...
      [color=blue]
      > David Moss <q0320811@mail. connect.usq.edu .au>'s wild
      > thoughts were released on Sun, 02 Apr 2006 00:25:05 GMT
      > bearing the following fruit:
      >[color=green]
      > >This seemed so easy at the beginning...
      > >
      > >I have a need to use xml data from a web server inside a vb.net program.
      > >During development it worked great - then came the real world.
      > >
      > >Some of the people who will use my application use autoproxy.
      > >They cannot access the web server directly, nor do they have proxy
      > >server information hard coded in their registries.
      > >
      > >Oh, and I'm using the .net 1.1 runtime (Visual Studio .net 2003)
      > >
      > >Does anyone know how to get out through a web proxy, determined by
      > >autoproxy, in vb.net and the 1.1 .net runtime?[/color]
      >
      > You need to ask in a dotnet group, this one if for VB6[/color]

      If you mean microsoft.publi c.dotnet.vb my question seems to be the only
      posting in there at this end. There has been no traffic in there for a
      week.

      I can't see any other .net specific newsgroups through my ISP.

      Hence my posting to a group that has vb in the title but no other
      qualifiers.

      I'm actually very sorry I moved from vb5 to .net.
      I was forced to do it for a Uni course I was doing.
      Since then I have not been able to write MS Office interactions and now
      there is this autoproxy issue. In vb5 I would have had this project done
      in under a week. In .net it looks like not getting done at all.

      I will probably have to fall back on plain old HTML and PHP to build the
      user interface. Thats so 10 years ago, but it seems to be my only
      option.

      --
      DM
      personal opinion only

      Comment

      • Rick Rothstein

        #4
        Re: vb.net and autoproxy

        > I can't see any other .net specific newsgroups through my ISP.

        You don't need your ISP to view Microsoft's public newsgroups. Set up a
        newsgroup account using msnews.microsof t.com for the server... this will
        expose all of the Microsoft newsgroups to you... you can filter them down to
        the dotnet ones easily enough from there. You might also try filtering on
        vsnet to see if there are any .NET groups there that are of interest.

        Rick


        Comment

        • Jan Hyde

          #5
          Re: vb.net and autoproxy

          David Moss <q0320811@mail. connect.usq.edu .au>'s wild
          thoughts were released on Tue, 04 Apr 2006 22:48:34 GMT
          bearing the following fruit:
          [color=blue]
          >In article <73c432dohq9dsk l1hi7ihlsa90t1q kj0a4@4ax.com>,
          >StellaDrinker@ REMOVE.ME.uboot .com writes...
          >[color=green]
          >> David Moss <q0320811@mail. connect.usq.edu .au>'s wild
          >> thoughts were released on Sun, 02 Apr 2006 00:25:05 GMT
          >> bearing the following fruit:
          >>[color=darkred]
          >> >This seemed so easy at the beginning...
          >> >
          >> >I have a need to use xml data from a web server inside a vb.net program.
          >> >During development it worked great - then came the real world.
          >> >
          >> >Some of the people who will use my application use autoproxy.
          >> >They cannot access the web server directly, nor do they have proxy
          >> >server information hard coded in their registries.
          >> >
          >> >Oh, and I'm using the .net 1.1 runtime (Visual Studio .net 2003)
          >> >
          >> >Does anyone know how to get out through a web proxy, determined by
          >> >autoproxy, in vb.net and the 1.1 .net runtime?[/color]
          >>
          >> You need to ask in a dotnet group, this one if for VB6[/color]
          >
          >If you mean microsoft.publi c.dotnet.vb my question seems to be the only
          >posting in there at this end. There has been no traffic in there for a
          >week.
          >
          >I can't see any other .net specific newsgroups through my ISP.
          >
          >Hence my posting to a group that has vb in the title but no other
          >qualifiers.[/color]

          Yes, well, that's microsoft's fault for calling two entirely
          different languages 'vb'
          [color=blue]
          >I'm actually very sorry I moved from vb5 to .net.
          >I was forced to do it for a Uni course I was doing.
          >Since then I have not been able to write MS Office interactions and now
          >there is this autoproxy issue. In vb5 I would have had this project done
          >in under a week. In .net it looks like not getting done at all.[/color]

          Look at the object having the problem, it will most likely
          have a proxy property. You can create a proxy class and and
          provide the users credentials, set the proxy property = to
          this and you should be able to get through the proxy (NB:
          this might not be acurate there are examples on the web
          though)

          J
          [color=blue]
          >I will probably have to fall back on plain old HTML and PHP to build the
          >user interface. Thats so 10 years ago, but it seems to be my only
          >option.[/color]


          Jan Hyde (VB MVP)

          --
          One of my friends got me a novelty card deck that had pictures of nude models on the backs, but my wife said she just couldn't deal with it.
          (David Reihmer)

          Comment

          • David Moss

            #6
            Re: vb.net and autoproxy

            In article <aot632lc9eugfp t48a0u316nrtlh6 4fsp3@4ax.com>,
            StellaDrinker@R EMOVE.ME.uboot. com writes...
            [color=blue]
            > Look at the object having the problem, it will most likely
            > have a proxy property. You can create a proxy class and and
            > provide the users credentials, set the proxy property = to
            > this and you should be able to get through the proxy (NB:
            > this might not be acurate there are examples on the web
            > though)[/color]

            Thanks, but this only works if the user is savvy enough to know their
            proxy server address or the proxy has been directly entered in the
            Internet Explorer proxy settings.

            When an autoproxy is used there is no proxy information available in the
            registry. Autoproxy retrieves a javascript file from the address in the
            autoproxy entry and processes that file for each URL to determine where
            the proxy for a particular domain is.

            In a complex organisation different proxy servers might be used for the
            Internet and different parts of the organisation, while other parts may
            bypass the proxy altogether.

            If I find a solution I will post it back into this thread.

            --
            DM
            personal opinion only

            Comment

            • Steve Gerrard

              #7
              Re: vb.net and autoproxy


              "David Moss" <q0320811@mail. connect.usq.edu .au> wrote in message
              news:MPG.1ea20c 05b9897254989d7 c@news.bigpond. com...[color=blue]
              > In article <aot632lc9eugfp t48a0u316nrtlh6 4fsp3@4ax.com>,
              > StellaDrinker@R EMOVE.ME.uboot. com writes...
              >
              > Thanks, but this only works if the user is savvy enough to know their
              > proxy server address or the proxy has been directly entered in the
              > Internet Explorer proxy settings.
              >[/color]

              I am curious about why are you having to mess with a proxy at all?
              I thought your client app would specify a web address, for either a web page or
              a web service, and make its request. If there is some proxy-stuff going on
              behind the scenes to get you connected to that address, so what?
              If one of the users enters www.google.com in a browser, presumably they get
              taken to that site, regardless of the hoops in between. How is your app
              different?
              I would actually like to know, since I am embarking on some corporate web
              development, and may be running through proxies in some cases.


              Comment

              • Max Healey

                #8
                Re: vb.net and autoproxy

                [color=blue]
                >
                > I am curious about why are you having to mess with a proxy at all?
                > I thought your client app would specify a web address, for either a web
                > page or a web service, and make its request. If there is some proxy-stuff
                > going on behind the scenes to get you connected to that address, so what?
                > If one of the users enters www.google.com in a browser, presumably they
                > get taken to that site, regardless of the hoops in between. How is your
                > app different?
                > I would actually like to know, since I am embarking on some corporate web
                > development, and may be running through proxies in some cases.
                >
                >[/color]

                This also interests me as that is ment to be one of the big features of
                ..Net. I had lots of trouble trying to use the Internet transfer controll in
                VB6
                to get data to or from a web server when ever a proxy got involved. I spent
                hours in the late 90's working out the WinInet API to get it to do as you
                suggest.


                I have moved to 2005 for new stuff that I am working on but have not had to
                do any web services yet, I just assumed all that stuff was sorted out.

                I found www.vbip.com the best place for all this stuff.


                Comment

                • Jan Hyde

                  #9
                  Re: vb.net and autoproxy

                  "Steve Gerrard" <mynamehere@com cast.net>'s wild thoughts
                  were released on Sat, 8 Apr 2006 09:53:09 -0700 bearing the
                  following fruit:
                  [color=blue]
                  >
                  >"David Moss" <q0320811@mail. connect.usq.edu .au> wrote in message
                  >news:MPG.1ea20 c05b9897254989d 7c@news.bigpond .com...[color=green]
                  >> In article <aot632lc9eugfp t48a0u316nrtlh6 4fsp3@4ax.com>,
                  >> StellaDrinker@R EMOVE.ME.uboot. com writes...
                  >>
                  >> Thanks, but this only works if the user is savvy enough to know their
                  >> proxy server address or the proxy has been directly entered in the
                  >> Internet Explorer proxy settings.
                  >>[/color]
                  >
                  >I am curious about why are you having to mess with a proxy at all?
                  >I thought your client app would specify a web address, for either a web page or
                  >a web service, and make its request. If there is some proxy-stuff going on
                  >behind the scenes to get you connected to that address, so what?[/color]

                  If your behind a proxy server you can't do anything without
                  providing credentials. Even the VB.Net IDE doesn't work
                  correctly from behind a proxy.
                  [color=blue]
                  >If one of the users enters www.google.com in a browser, presumably they get
                  >taken to that site, regardless of the hoops in between. How is your app
                  >different?[/color]

                  No you wouldn't, you'd at best be propted for the proxy
                  authentication, at worsed be denied access.
                  [color=blue]
                  >I would actually like to know, since I am embarking on some corporate web
                  >development, and may be running through proxies in some cases.[/color]

                  Best thing is to try it from behind a proxy yourself and see
                  what a PITA it is.




                  Jan Hyde (VB MVP)

                  --
                  Inheritance: Will gotten gains (Stan Kegel)

                  Comment

                  • Jan Hyde

                    #10
                    Re: vb.net and autoproxy

                    "Max Healey" <maxat@healey.c om.au>'s wild thoughts were
                    released on Sun, 9 Apr 2006 08:16:56 +1000 bearing the
                    following fruit:
                    [color=blue]
                    >[color=green]
                    >>
                    >> I am curious about why are you having to mess with a proxy at all?
                    >> I thought your client app would specify a web address, for either a web
                    >> page or a web service, and make its request. If there is some proxy-stuff
                    >> going on behind the scenes to get you connected to that address, so what?
                    >> If one of the users enters www.google.com in a browser, presumably they
                    >> get taken to that site, regardless of the hoops in between. How is your
                    >> app different?
                    >> I would actually like to know, since I am embarking on some corporate web
                    >> development, and may be running through proxies in some cases.
                    >>
                    >>[/color]
                    >
                    >This also interests me as that is ment to be one of the big features of
                    >.Net. I had lots of trouble trying to use the Internet transfer controll in
                    >VB6
                    >to get data to or from a web server when ever a proxy got involved. I spent
                    >hours in the late 90's working out the WinInet API to get it to do as you
                    >suggest.
                    >
                    >
                    >I have moved to 2005 for new stuff that I am working on but have not had to
                    >do any web services yet, I just assumed all that stuff was sorted out.
                    >
                    > I found www.vbip.com the best place for all this stuff.
                    >[/color]

                    Could I suggest we start a new thread about this in a
                    'dotnet' group, we really are off topic here,



                    Jan Hyde (VB MVP)

                    --
                    Apprenticeship: Hire learning (Leopold Fechtner)

                    Comment

                    • Steve Gerrard

                      #11
                      Re: vb.net and autoproxy


                      "Jan Hyde" <StellaDrinker@ REMOVE.ME.uboot .com> wrote in message
                      news:1g4k32dufo je6htgaqlaej9b6 8l2mu5302@4ax.c om...[color=blue]
                      > "Steve Gerrard" <mynamehere@com cast.net>'s wild thoughts
                      > were released on Sat, 8 Apr 2006 09:53:09 -0700 bearing the
                      > following fruit:
                      >[color=green]
                      >>If one of the users enters www.google.com in a browser, presumably they get
                      >>taken to that site, regardless of the hoops in between. How is your app
                      >>different?[/color]
                      >
                      > No you wouldn't, you'd at best be propted for the proxy
                      > authentication, at worsed be denied access.
                      >[/color]

                      Just as I feared, I don't know squat about proxy servers. I don't think that is
                      what we have at work after all; in fact, I've never seen such a thing. If Google
                      don't work, your Internets are broken, that's what I say.



                      Comment

                      • David Moss

                        #12
                        Re: vb.net and autoproxy

                        In article <44383662$0$760 0$afc38c87@news .optusnet.com.a u>,
                        maxat@healey.co m.au writes...
                        [color=blue]
                        >[color=green]
                        > >
                        > > I am curious about why are you having to mess with a proxy at all?
                        > > I thought your client app would specify a web address, for either a web
                        > > page or a web service, and make its request. If there is some proxy-stuff
                        > > going on behind the scenes to get you connected to that address, so what?
                        > > If one of the users enters www.google.com in a browser, presumably they
                        > > get taken to that site, regardless of the hoops in between. How is your
                        > > app different?
                        > > I would actually like to know, since I am embarking on some corporate web
                        > > development, and may be running through proxies in some cases.
                        > >
                        > >[/color]
                        >
                        > This also interests me as that is ment to be one of the big features of
                        > .Net. I had lots of trouble trying to use the Internet transfer controll in
                        > VB6
                        > to get data to or from a web server when ever a proxy got involved. I spent
                        > hours in the late 90's working out the WinInet API to get it to do as you
                        > suggest.
                        >
                        >
                        > I have moved to 2005 for new stuff that I am working on but have not had to
                        > do any web services yet, I just assumed all that stuff was sorted out.
                        >
                        > I found www.vbip.com the best place for all this stuff.[/color]

                        Thanks for the link Max.

                        As to proxy and autoproxy, it is relevant to all flavours of VB, its
                        just a bit harder with VB.NET because you can't just bring in a COM
                        object to help.

                        Heres a quick synopsis of proxy:

                        Direct connection: exactly what it says. If your VB app needs to access
                        a URL it connects to the server directly and gets it. This isn't really
                        a problem for the home user or small office with a few workstations, but
                        it can result in unnecessary multiple downloads of the same file in a
                        larger setup. Imagine a small group of, say, 5 stockbrokers in an office
                        sharing a single 128kb/s ISDN feed. Every morning at 9am they all look
                        at the stock exchange home page to see the market news. Without proxy it
                        will take 5 times as long as it should to retrieve the page as all 5 of
                        them will be trying to pull it down the 128k feed at the same time.

                        Hard-coded proxy: all URLs are downloaded from the same proxy server.
                        This helps eliminate the problem of multiple downloads. With a proxy
                        server in the office the file would be pulled down the slow 128k link
                        once, stored in a cache, and shared out among the 5 brokers at 10, 100
                        or 1000Mb/s. In a small to medium site a single hard-coded proxy address
                        is OK, but in large operations (mine has 100,000 users or more in it) a
                        single proxy server would itself become a bottleneck. With a hard-coded
                        proxy the address and port of the proxy server are recorded in the
                        registry.

                        Autoproxy: Instead of recording an address and port for a proxy server
                        in the registry, the URL of a file that contains advanced proxy
                        information is recorded. There is often no actual proxy address or port
                        available in the registry. Instead a javascript file, usually named
                        autoproxy.pac, is automatically downloaded the first time a URL is
                        requested. The FindProxyForURL () method is called in this javascript
                        with the desired URL as a parameter and it returns the correct proxy
                        address and port to use with that URL. This allows multiple proxy
                        servers to be run by the organisation, each optimised for a particular
                        kind of information. For URLs inside the local Intranet DIRECT might be
                        returned by FindProxyForURL (), allowing for direct access to files that
                        do not have to be retrieved over slow links. Information from different
                        departments might be obtained from that department's own proxy server
                        while Internet files may be obtained through one or more proxy servers
                        shared by the whole organisation.

                        My own organisation has hundreds of thousands of users, thousands of
                        sites and dozens of departmental Intranets. It is a very big site, but
                        fairly typical of very large multinational companies. Because of the
                        size and complexity of the organisation autoproxy is used on nearly all
                        workstations.

                        An added advantage of proxy servers is they can be set up to require
                        authentication. That means people inside an organisation have no trouble
                        accessing local files directly, but a username and password is needed
                        before they can access files on the Internet, or perhaps files from
                        other departments. This can have immense productivity implications, both
                        positive and negative.

                        If you are a person who only uses Internet Explorer, proxy and autoproxy
                        are magical background helpers that speed your data flow.

                        If you are a programmer, proxy and autoproxy are industrial grade
                        headaches that stop your application getting to the data it needs
                        without a lot of extra work.

                        The trick is finding out what kind of proxy system is in use, if any,
                        and tailoring the data access accordingly.

                        Direct connection: no worries. It just works.

                        Hard-coded proxy is a little harder: you can find details of the hard-
                        coded proxy address and port in the registry under
                        HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Internet
                        Settings]
                        "ProxyEnable"=d word:00000001
                        "ProxyServer"=" Proxy.Mycompany .com:8080"

                        VB has ways of obtaining this information from the registry, so its just
                        a matter of reading it and using information with your objects as Jan
                        suggested.

                        Autoproxy is harder still. There is often no hard-coded proxy server or
                        port at all in the registry, instead the location of the autoproxy
                        script is available:

                        [HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Internet
                        Settings]
                        AutoConfigProxy =wininet.dll
                        AutoConfigURL=h ttp://autoproxy.mycom pany.com

                        Knowing WHERE the information lives is useful, but it is up to YOU the
                        programmer to parse the autoproxy.pac file that lives there for each URL
                        and set up a proxy on your objects accordingly.

                        A complicating factor is that a proxy server often requires
                        authentication details. Internet Explorer simply pops up a
                        username/password dialog when this occurs. Your program will have to
                        deal with this situation automatically.

                        So your program may need to detect the kind of proxy in use and act
                        accordingly. In the "worst case" it may need to parse a javascript file
                        to determine the appropriate proxy server and deal with user
                        authentication when it connects.

                        Oh, and just to cap it off, the information in the autoproxy.pac file
                        may change from access to access. Suppose a proxy server goes down for
                        maintenance or fails. The network administrator can change the data flow
                        throughout the organisation simply by changing a single line in
                        autoproxy.pac. Ideally your program has to be able to deal with a
                        dynamic network environment, detect failures, reload autoproxy.pac and
                        reconfigure proxy on its objects accordingly. Second place goes to the
                        program that crashes and has to be restarted to reload up to date proxy
                        information when a network reconfiguration occurs.

                        I hope this helps some people get to grips with proxy and autoproxy.
                        I've tried to keep my discussion generic so it will apply to all
                        flavours of VB. Have a great day everyone.

                        --
                        DM
                        personal opinion only

                        Comment

                        Working...