Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I've been working on this web chat application Build a Web Chat Application using Build a Web Chat Application using ASP.Net 3.5, LINQ and AJAX (in C# 3.5 or VB 9.0)[^] but there's always a problem I tried a lot to solve but no hope.

Which is: I have specific rooms and each room is specified to certain users so that users in one room can talk together without people in other rooms can see them.
The problem is that users enter wrong rooms!

Although they are directed to the right room, their names are added to the wrong room list!

I used the same code as in the link before and I tested it and it has the same problem!

Please, can anyone help me.

[Edit - corrected Link - Henry /]
Posted
Updated 9-Apr-11 2:39am
v4
Comments
Keith Barrow 3-Apr-11 18:21pm    
Without any code it is difficult to tell what is going on. The link is broken or it as been removed. If you are referring to an article, please ask you question in the comments at the bottom of the article screen, no-one knows the code better than the author!
Dalek Dave 9-Apr-11 8:39am    
Edited for Grammar, Syntax and Readability.

1 solution

112 if (user == null)
113 {
114 LoggedInUser loggedInUser = new LoggedInUser();
115 loggedInUser.UserID = Convert.ToInt32(Session["ChatUserID"]);
116 loggedInUser.RoomID = Convert.ToInt32(lblRoomId.Text);
117 db.LoggedInUsers.InsertOnSubmit(loggedInUser);
118 db.SubmitChanges();
119 }

If you used the code from the article and redirected to a different roomid (on the querystring in the demo), but you forgot to update line 116 (above) to the correct roomid, that would cause the problem you describe. (note: it's taking the id from a form value instead of the session value) That it? :)
 
Share this answer
 
v2
Comments
Dalek Dave 9-Apr-11 8:39am    
Well Spotted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900