473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Session State Username and Cookies?

I am trying to get session stating working with certain specifications
right now, and am running into an issue I can't peg. I currently have
session stating running have changed my web.config file to SQLstate and
ran the installsqlstate.sql script through the query analyzer. This is
all fine and good, however this application users integrated windows
authentication so I would assume it would write to the database,
however I am having trouble hooking this event to happen with the
default session stating.

This is what I have so far regarding the session stating and setting
the cookies.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication1
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox user;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox pass;
protected System.Web.UI.WebControls.Label msg;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand2;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
public System.Data.DataSet dataSet1;
protected System.Data.DataTable dataTable1;
protected System.Web.UI.WebControls.Label msg1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
Session["var"] = user.Text;
string sessio = Session["var"].ToString();
Response.Cookies["test"].Value = user.Text ;
DateTime dtime = DateTime.Now;
Response.Cookies["test"].Expires = DateTime.Now.AddMinutes(1);

SqlConnection conn = new
SqlConnection(sqlConnection1.ConnectionString);
conn.Open();
SqlCommand cmd1 = new SqlCommand("UPDATE userlogin SET
SessionID='"+sessio.ToString()+"', ClickTime = '"+dtime.ToString()+"',
ExpireTime='"+Response.Cookies["test"].Expires.ToString()+"',
Cookie='"+Response.Cookies["test"].Value+"' WHERE
UserID='"+user.Text+"'",conn);
cmd1.ExecuteNonQuery();
conn.Close();
}

Any ideas?

Oct 11 '05 #1
0 1090

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
1
by: Ann Leland | last post by:
I have been using session variables to pass a user name from one ASP page to another inside framesets for 9 months and it stopped working this week. I have made no code changes but there was a...
2
by: wellnesseducation | last post by:
I am trying to get session stating working with certain specifications right now, and am running into an issue I can't peg. I currently have session stating running have changed my web.config file...
3
by: Karsten Grombach | last post by:
Hi, I'm trying the following: - Imitate a Logon using a Post with HttpWebRequest on remote Webserver (asp 3.0 page using https) - On success redirect to the page (encapsuled in an iframe)...
9
by: RA | last post by:
Hi Please review and let me know if I am correct: 1) My understanding from reading http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/ diforwc-ch05.asp is that...
2
by: jakk | last post by:
Iam storing the session state in SQL Server. The Session gets stored in the SQL Server temp tables ( I can see some values in the two tables), but the session doesnt seem to timeout. We have a...
13
by: Goofy | last post by:
Does anyone know how I can kill a session by session ID ? -- Goofy
11
by: Glenn | last post by:
Hi I've been experimenting with managing state using the Session object. I've created a simple WS with a couple of methods, one which sets a string value, another that retrieves it. Each...
0
by: krishna81m | last post by:
Could some one please explain why the session is not being maintained when I am doing a forward in a servlet after setting a cookie. I am even unable to set session attributes or parameters and...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.