Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Distinguishing dialup users from broadband users without javascript

Distinguishing dialup users from broadband users without javascript

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptphpasp-netcom
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dennis Dykstra
    wrote on last edited by
    #1

    I'm hoping to cash in on the well-known ASP.Net expertise of CodeProject members. Currently I'm working on an ASP.Net website for a nonprofit organization with users in many developing countries, including locations where only dialup is available. The organization has determined that many of its users have disabled javascript for security reasons. The organization wants the new website to be graphically appealing, but also wants to be able to turn off most of the graphics for dialup users. This means we have to have some way of determining whether a request comes from a user on dialup or on broadband. The organization wants its home page to be filled with graphics for broadband users, which means there has to be a way to detect the connection speed in the background before sending a visible response to the browser. At first I thought this wouldn't be possible from the server side. Although the advice I've found by searching many forums (including this one) suggested largely that this is the case, a few people thought it should be possible. Most of the suggestions involved timing downloads through WebClient or WebRequest/WebResponse. By running a number of tests on both dialup and broadband connections I've determined that the download method doesn't work because what's being timed is the length of time needed to send the download; without javascript there's no way to tell when it has actually been received by the browser. A different approach was suggested via a PHP script posted by Emanuele Feronato on her blog[^]. This approach involves sending some text to the browser, one KB at a time, and flushing the response after each KB. She suggested sending 512 KB to get a good estimate of the connection speed, but that's far too much for dialup users to endure. I tested her approach with 16 KB and it seemed to give reasonable results. Since PHP is a server-side technology, I thought this might work in ASP.Net as well. My C# code for the approach is below. The text I'm sending is just a collection of dots (ASCII 0x2e). To hide the text being pushed to the browser I've used a <span style="display:none;"></span> around it. Emmanuele used comment tags around the text to accomplish the same thing. Here are a few things I've noticed: 1. The method doesn't work

    A 1 Reply Last reply
    0
    • D Dennis Dykstra

      I'm hoping to cash in on the well-known ASP.Net expertise of CodeProject members. Currently I'm working on an ASP.Net website for a nonprofit organization with users in many developing countries, including locations where only dialup is available. The organization has determined that many of its users have disabled javascript for security reasons. The organization wants the new website to be graphically appealing, but also wants to be able to turn off most of the graphics for dialup users. This means we have to have some way of determining whether a request comes from a user on dialup or on broadband. The organization wants its home page to be filled with graphics for broadband users, which means there has to be a way to detect the connection speed in the background before sending a visible response to the browser. At first I thought this wouldn't be possible from the server side. Although the advice I've found by searching many forums (including this one) suggested largely that this is the case, a few people thought it should be possible. Most of the suggestions involved timing downloads through WebClient or WebRequest/WebResponse. By running a number of tests on both dialup and broadband connections I've determined that the download method doesn't work because what's being timed is the length of time needed to send the download; without javascript there's no way to tell when it has actually been received by the browser. A different approach was suggested via a PHP script posted by Emanuele Feronato on her blog[^]. This approach involves sending some text to the browser, one KB at a time, and flushing the response after each KB. She suggested sending 512 KB to get a good estimate of the connection speed, but that's far too much for dialup users to endure. I tested her approach with 16 KB and it seemed to give reasonable results. Since PHP is a server-side technology, I thought this might work in ASP.Net as well. My C# code for the approach is below. The text I'm sending is just a collection of dots (ASCII 0x2e). To hide the text being pushed to the browser I've used a <span style="display:none;"></span> around it. Emmanuele used comment tags around the text to accomplish the same thing. Here are a few things I've noticed: 1. The method doesn't work

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Hey... Believe me .. this should be in your own blog post. While reading each of the scenarios.. whatever solution that comes in mind is already tried by you. Really if you dont flush your buffered output, it doesnt goes to the browser and the browser instead of downloading, it actually waits for response. Now if you are dealing with full postbacks, it is hard to use javascript. You might try partial postback using AJAX as well if possible to determine using Javascript. But I am really not sure if it can give you the exact download speed. I think it is always better to have multiple ajax call (Just what gmail does) so that from the first call, it starts a timer in javascript (Say using SetInterval) and after a certain timeout for the timer, you show a message to switch to html view. This might be a good way of doing this. :)

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      D 1 Reply Last reply
      0
      • A Abhishek Sur

        Hey... Believe me .. this should be in your own blog post. While reading each of the scenarios.. whatever solution that comes in mind is already tried by you. Really if you dont flush your buffered output, it doesnt goes to the browser and the browser instead of downloading, it actually waits for response. Now if you are dealing with full postbacks, it is hard to use javascript. You might try partial postback using AJAX as well if possible to determine using Javascript. But I am really not sure if it can give you the exact download speed. I think it is always better to have multiple ajax call (Just what gmail does) so that from the first call, it starts a timer in javascript (Say using SetInterval) and after a certain timeout for the timer, you show a message to switch to html view. This might be a good way of doing this. :)

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        D Offline
        D Offline
        Dennis Dykstra
        wrote on last edited by
        #3

        Thank you for this reply. However, it doesn't really help because as noted in the original question I have to do the detection without javascript. AJAX won't be much help without javascript. But thanks anyway for the thought. :)

        A 1 Reply Last reply
        0
        • D Dennis Dykstra

          Thank you for this reply. However, it doesn't really help because as noted in the original question I have to do the detection without javascript. AJAX won't be much help without javascript. But thanks anyway for the thought. :)

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          As I told you... The possible solutions that are there for you are already tried by you. No one can give you any other solution.. if I am right. :rose:

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups