Results 1 to 11 of 11

Thread: Session state using SQLSERVER

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Session state using SQLSERVER

    Hi
    I am tring to store session variables in sql server
    for that i have made following cjanges:
    in web.config:
    and run InstallSQlstate.sql from this folder
    C:\WINNT\Microsoft.NET\Framework\v1.0.3705

    i have witten following code for this
    private void Button1_Click(object sender, System.EventArgs e)
    {
    Session["Se"]= TextBox1.Text;
    Response.Write(Session["Se"].ToString());

    }


    Now I am not able to store my session data is sql Server.
    can anybody know..anything more to do to get session data.

    thanks in advance.

    PPCC

  2. #2
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Re: Session state using SQLSERVER

    Save Value in Cookies
    for store value
    Response.Cookies["SessionName"].Value = textBox.text;

    for get value

    string SessionID = (string)Request.Cookies["SessionName"].Value;

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: Session state using SQLSERVER

    it means i can't store values in SQL server...then what is this SessinState element in web.config file does

  4. #4
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Re: Session state using SQLSERVER

    no u can also store in SQL server but its better put valuse in session variable

    EnableSessionState="false"

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: Session state using SQLSERVER

    hey man i don't understand where to write EnableSessionState="false neither page nor web.config allowed.

  6. #6
    Addicted Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    141

    Re: Session state using SQLSERVER

    <%@ Page language="c#" Codebehind="SignIn.aspx.cs" AutoEventWireup="false" Inherits="Sample.Web.SignIn" EnableSessionState="false" EnableViewState="false" %>

    IN html Portion

  7. #7
    Member
    Join Date
    Jan 2006
    Location
    UK
    Posts
    61

    Re: Session state using SQLSERVER

    Hi PPCC

    What error messages do you get when you try to save to the sql server session state?

    Chris Seary

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: Session state using SQLSERVER

    Quote Originally Posted by oldbear
    Hi PPCC

    What error messages do you get when you try to save to the sql server session state?

    Chris Seary
    No error message but can't stored value in SQL server.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Session state using SQLSERVER

    Did you add:

    Code:
    <sessionState
      mode="SQLServer"
      sqlConnectionString="data source=server;user id=uid;password=pwd"
      cookieless="false" timeout="20" />
    in web.config?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: Session state using SQLSERVER

    Quote Originally Posted by mendhak
    Did you add:

    Code:
    <sessionState
      mode="SQLServer"
      sqlConnectionString="data source=server;user id=uid;password=pwd"
      cookieless="false" timeout="20" />
    in web.config?
    yes i added that in web.config file..but no luck

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: Session state using SQLSERVER

    hi buddies,I am looking in ASPStateTempSessions table..Hope session data get stored here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width