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