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. Connection closes on browsing the same site in two browsers on the same computer

Connection closes on browsing the same site in two browsers on the same computer

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netmysql
10 Posts 4 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
    Dot Net Dev
    wrote on last edited by
    #1

    Hi, We have developed a web application in ASP.NET C#/ MYSQL(5). Everything is working fine but when i browse the certain web page in the two browsers at the same time i get the following type of exceptions: ObjectDisposedException, cannot open the closed stream, connection closed unexpectedly or some sort of socket exceptions. Thanks Sonia Shahid

    G C 2 Replies Last reply
    0
    • D Dot Net Dev

      Hi, We have developed a web application in ASP.NET C#/ MYSQL(5). Everything is working fine but when i browse the certain web page in the two browsers at the same time i get the following type of exceptions: ObjectDisposedException, cannot open the closed stream, connection closed unexpectedly or some sort of socket exceptions. Thanks Sonia Shahid

      G Offline
      G Offline
      Gamzun
      wrote on last edited by
      #2

      sounds like your database connectivity is not handled properly. did you try debugging it?

      D 1 Reply Last reply
      0
      • D Dot Net Dev

        Hi, We have developed a web application in ASP.NET C#/ MYSQL(5). Everything is working fine but when i browse the certain web page in the two browsers at the same time i get the following type of exceptions: ObjectDisposedException, cannot open the closed stream, connection closed unexpectedly or some sort of socket exceptions. Thanks Sonia Shahid

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Hard to say why your code is broken without seeing it, but it's obviously poorly written.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        A 1 Reply Last reply
        0
        • G Gamzun

          sounds like your database connectivity is not handled properly. did you try debugging it?

          D Offline
          D Offline
          Dot Net Dev
          wrote on last edited by
          #4

          If I test it in one browser at a time then I didn't get this problem. If there is database connectivity problem it should also occur when i test it in one browser. Our project is running smoothly we face this problem only when we browse the same link, at the same time, in two browsers on one computer. Thanks Sonia Shahid

          C G 2 Replies Last reply
          0
          • D Dot Net Dev

            If I test it in one browser at a time then I didn't get this problem. If there is database connectivity problem it should also occur when i test it in one browser. Our project is running smoothly we face this problem only when we browse the same link, at the same time, in two browsers on one computer. Thanks Sonia Shahid

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Sonia Shahid wrote:

            . If there is database connectivity problem it should also occur when i test it in one browser.

            No, your problem is that your database code is crap, and therefore when you have two connections at once, it blows up.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            1 Reply Last reply
            0
            • D Dot Net Dev

              If I test it in one browser at a time then I didn't get this problem. If there is database connectivity problem it should also occur when i test it in one browser. Our project is running smoothly we face this problem only when we browse the same link, at the same time, in two browsers on one computer. Thanks Sonia Shahid

              G Offline
              G Offline
              Gamzun
              wrote on last edited by
              #6

              there must be some code that tries to open a stream or file, you can debug even with two different browsers. Try hitting the same link with two different browsers(Mozilla and IE would work greatly) and then try to figure out whats wrong. Happy debugging!

              1 Reply Last reply
              0
              • C Christian Graus

                Hard to say why your code is broken without seeing it, but it's obviously poorly written.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                A Offline
                A Offline
                anilaabc
                wrote on last edited by
                #7

                if it is poorly written then why it works fine in one browser

                G C 2 Replies Last reply
                0
                • A anilaabc

                  if it is poorly written then why it works fine in one browser

                  G Offline
                  G Offline
                  Gamzun
                  wrote on last edited by
                  #8

                  you've your answer in your question

                  1 Reply Last reply
                  0
                  • A anilaabc

                    if it is poorly written then why it works fine in one browser

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    I'm sorry, but we're trying to help you and you're just showing signs of being dense. It's called a race condition, only in this case, your multiple threads are actually different users. For objects to exist and be the same for many users, I assume they are declared as static. Hard to say anything else, you asked us to fix your broken project, but didn't post any code ( showing us the block that blew up would stop us from having to guess what is going on ). Now you're all defensive because we tried to help you. The person who wrote this code plainly did not understand ASP.NET because your multiple users are sharing an object which gets disposed of in your code.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    D 1 Reply Last reply
                    0
                    • C Christian Graus

                      I'm sorry, but we're trying to help you and you're just showing signs of being dense. It's called a race condition, only in this case, your multiple threads are actually different users. For objects to exist and be the same for many users, I assume they are declared as static. Hard to say anything else, you asked us to fix your broken project, but didn't post any code ( showing us the block that blew up would stop us from having to guess what is going on ). Now you're all defensive because we tried to help you. The person who wrote this code plainly did not understand ASP.NET because your multiple users are sharing an object which gets disposed of in your code.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      D Offline
                      D Offline
                      Dot Net Dev
                      wrote on last edited by
                      #10

                      Below is my code which is throwing Exception: Public Function populateDataset(ByVal strQuery As String, ByRef ds As DataSet, Optional ByVal strTableName As String = "") As Int16 Try If Not IsNothing(ds.Tables(strTableName)) Then ds.Tables(strTableName).Clear() End If Catch ex As Exception End Try populateDataset = -1 checkConnection() Try oledbDA = New MySqlDataAdapter(strQuery, cnDB) If strTableName = "" Then oledbDA.Fill(dataSet:=ds) Else oledbDA.Fill(dataSet:=ds, srcTable:=strTableName) End If populateDataset = 0 oledbDA.Dispose() Catch ex As MySqlException Throw ex Return -1 Catch ex As Exception populateDataset = -1 Throw ex End Try End Function Here i am calling it: public void getItemCategory(ref DataSet ds,string qry,string tableName) { dlib.CloseConnection(); dlib.populateDataset(qry, ref ds, tableName); }

                      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