Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
4.50/5 (4 votes)
Hi All

So one of the features I've been trying to construct is a feature where one user can create a temporary session/page, and should be accessible to users they "invite", ie send an invitation to view/collaborate. My issue is how to create sessions/instances of a temporary asp.net page and get multiple users to view the very same session asynchronously, as it will be updated by the users in real-time. Is there any particular way to get users to keep access to the same session while its active? The only other thing I can imagine that is similar is maybe a chat room, in that it manages which users are "online" and which aren't. Is there some kind of asp.net library that already supports this? Am I over-thinking this?
Posted
Comments
Member 14740562 16-Feb-20 6:54am    
protected void btn_Click(object sender, EventArgs e)
{
con.Open();
String myquery = "select * from S_register";
SqlCommand cmd = new SqlCommand();
cmd.CommandText = myquery;
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
String uname;
String pass;
uname = ds.Tables[0].Rows[1]["id"].ToString();
pass = ds.Tables[0].Rows[1]["passcode"].ToString();
con.Close();
if (uname == TextBox1.Text && pass == TextBox2.Text)
{
Session["username"] = uname;
Response.Redirect("Login_successfull_user.aspx");
}
else
{
L1.Text = "Invalid Username or Password - Relogin with Correct Username Password";
}

The above code make only one credentiol to login which is present at the first row of register table.What is the solution fon make login with other user credentials

1 solution

If i understand you well, you can NOT use Session[^] object. Why? The ASP.NET pages use a memory-less HTTP protocol. It meant that every time a client requests WEB based application, HTTP has no idea of the caller's identity. It forwards the request to the Web server. The Session object is used to store data unique to a particular client while that client is connected to a Web application. For example, when a user logs on to a Web application, his personal information like login, name, password, etc. could be stored in a Session variables.

Nevertheless...
Some useful information, you'll find here: Sharing ASP.NET Session State Across Applications[^]

But...
I really do believe you're talking about centralized data caching[^]. As is discussed in this article, SqlDependency class[^] will be the best solution for you. You'll be able to share data between users in real time. Please, follow the below and all related links.
SqlDependency in an ASP.NET Application[^]
 
Share this answer
 

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