Session State InProc. HELP??????

Jul 23, 2005

Hi

Can anyone help me with Session Management in ASP.NET. I have a web
application with a login page and i need to retain the username after
he logs in. This is what I have in Config Files


Global.asax

<OBJECT RUNAT="SERVER" SCOPE="SESSION" ID="MyInfo"
PROGID="Scripting.Dictionary">
</OBJECT>

web.config

<configuration>
<!-- This section stores your SQL configuration as an appsetting
called
conn. You can name this setting anything you would like.
-->
<appSettings>
<add key="conn"
value="server=ADVAITH;database=tis;uid=sa;pwd=;" />
</appSettings>
<!-- This section sets the authentication mode to forms
authentication
and routes all traffic to the specified page. It also
specifies a
timeout. The authorization section below denies all users not

authenticated. For testing purposes, custom errors was turned
off.
The section below allows pages to be trace enabled for
debugging
-->
<system.web>

<sessionState
mode="InProc"
cookieless="false"
timeout="20" />

<authentication mode="Forms">
<forms name="MyFormsAuthentication" loginUrl="login.aspx"
protection="All" timeout="720" />
</authentication>

<authorization>
<deny users="?" />
</authorization>

<customErrors mode="Off" />

<trace enabled="true" requestLimit="0" pageOutput="true" />

</system.web>

<system.web>

</system.web>
</configuration>

When i assign the user name in the log in page it works

session("username") = txtUsername.Text

But if I use a new session variable or the username(session variable as
declared in the login page, in the menu page it gives me error saying
that Decralation is expected . Is there any files that i need to import
b4 using sessions??

Please help me out. My email:bramanujam@gmail.com

View 1 Replies


ADVERTISEMENT

SQL Server Session State - Using A 1.1 Database Schema For 2.0 Session State Storage

Aug 3, 2006

The 2.0 version of ASPSTATE is slightly different than the 1.1 version in that one table has one additional column and another table uses a different data type and size for the key. The 2.0 version also has a couple additional stored procedures.

We'd like to manage just one session state database if possible so we're trying to figure out if Microsoft supports using the new schema for 1.1 session state access (it seems to work, but our testing has been very light).

Is there any official support line on this? If not, can anyone comment on whether or not you'd expect it to work and why?

Thanks.

View 1 Replies View Related

Store Session State In Sql 2000?

Apr 17, 2007

I'm currently storing session state in a sql 2000 server for my vs.net 2002 projects. I'm currently developing a new project using vs.net 2005 and was wondering if I could store the session state in the same sql server. Does anyone know if this is possible? If so can someone point me in to an article or code example. All of the examples I have come across are for sqlExpress.
Thanks in advanceJason

View 1 Replies View Related

Using ASP.NET Session State In SQL 2005 With A Mirror

Jun 22, 2006

I have SQL 2005 mmirroring sucessfully working in an ASP.NET 2.0 web application. I also have session state being maintained in SQL Server using the built-in functionality in ASP.NET. The problem is, even with "allowCustomSqlDatabase=True" and specifying a failover partner in the DSN, it appears that ASP.NET does not work with the failover partner. It always tries to get the session info from the "data source" server specified in the DSN.

Is there a way to get the session state to fail over to the mirrored server without writing a custom session state provider?

View 7 Replies View Related

SQL Server 2005 SP2 -- Error With ASP.Net Session State Using TempDB

Mar 14, 2007

I have an ASP.Net (C# 2.0) application that has been using SQL Server 2005 Standard Edition with Service Pack 1 to hold the session state in a testing environment.  Currently, the session state is being stored in TempDB, rather than the ASPState database.  This has worked very well for us until yesterday.  We installed SQL Server 2005 Service Pack 2, as well as the Critical Update for Service Pack 2 (KB933508).  Once the SQL server was rebooted, I got the following error message when I tried to access the web application.
The SELECT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.The SELECT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.The INSERT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'. 
In the web.config file for the application, I have a SQL username and password defined that can access the ASPState database.  To correct this issue, I had to give this user db_datareader and db_datawriter access to tempDB.
 
Has anyone else run across this problem, and is it related to SQL Server 2005 Service Pack 2?

View 1 Replies View Related

Problems Storing Session State In SQL Server Database

Jul 26, 2004

I am contemplating storing session state data in a SQL server database (created by running the installSqlState.sql script included in the .NET framework installation) and have established a functioning connection to the database but I am constantly getting "access denied". I've found that tweeking the permission settings in SQL for the ASP.NET user is resolving each specific error that arises but was wondering if there is a more "global" resolution? I'm finding myself having to manually check off each individual object and every option or is this what is needed to resolve the "access denied" error?

Thank you.

View 1 Replies View Related

Maintain Session State Throught Application For Long Time

Mar 31, 2008


Hi,

I need the application not to expire the session always. I need to maintain the session always even if the user keeps the web application idle for long time.

Regards,
Saravanan Gajendran

View 3 Replies View Related

SQL Security :: How To Create A Low Privilege User And Role For Server Session State

May 26, 2015

An old website I inherited uses sa to connect to SQL SessionState and had the details in the web.config. This is bad for security.The session state database is of -sstype "t" which is defined as:Temporary. Session state data is stored in the SQL Server tempdb database. Stored procedures for managing session state are installed in the SQL Server ASPState database. Data is not persisted if you restart SQL. This is the default.What kind of WIndows user, SQL Login, role and permissions do I need to create to make Session State secure? (Windows Server 2012 and SQL Server 2012 mixed mode authentication, Webfarm).

View 4 Replies View Related

Mirror And Witness Connection In A Disconnected State Immediately After Adding Witness Server To Mirror Session.

Jan 31, 2008


After adding the Witness Server to the Mirror session, the Witness Connection state between the Mirror and Witness Connection is Disconnected and the state between Principal and Witness Connection is Connected.

The procedures defined in Books Online was used to setup Database Mirroring...when the Witness server was added to the Mirror session, only the alter database T-SQL statement was executed on the Principal server.

ALTER DATABASE <db_name> SET WITNESS = 'TCP://<servername>:<port>'

After executing the above statement, a few seconds later the state between Principal and Witness Connection changed to Connected and the state between Mirror and Witness Connection remains Disconnected.

The Mirror session is not using Certificates, every server is on the same domain, using the same domain login account, and all servers have SP2 installed running Enterprise Edition.

Any idea's why the state between Mirror and Witness Connection remains Disconnected?

Thanks,

View 9 Replies View Related

Principal Db In Principal, Synchronizing State, The Mirror In Restoring State

Sep 26, 2007

We have mirroring setup for 5 dbs, 4 of which are synchronized and 1 which is in "synchronizing" state on the principal and "restoring" state on the mirror. Mirroring for all dbs has been working fine for the past several months and we have a witness that has allowed automatic failover in the past without problems.

This database has several bulk inserts performed throughout the day and am sure there is some latency due to the size of these transactions.

Not sure as to why this is happening all of a sudden, but the db in question has been in this state for the past 12 hrs. I checked the mirroring status on the principal and it states that it is "synchronizing: data is being transferred from principal to mirror", but the mirror server states that db is in "restoring" state. Can anyone suggest as to how I can get the database on the mirroring server to get back to "mirror, synchronizing/restoring..." state? Or suggest on how I can troubleshoot this?

Thanks in advance.

View 3 Replies View Related

Session

Sep 20, 2001

Hi all,

I need some solution..
When i execute a program it first deletes all datas from a
'X' table .Then fetches data from various other tables and
inserts into this 'X' table.I finally generate a report from
this 'X' table.

Now the problem is,
USER 1 : Executes the program - Datas in 'X' table got deleted and
filled up with new data.Report is getting processed.....
USER 2 : Executes the same program - Datas in the same 'X' table
getting deleted ..
So the report process of USER 1 got affected.

Solution 1 : Using IP address of local machine i solved the problem.But
i need a concrete solution for this ..something related to sessions..

CAN ANYONE HELP ??

Thanx and Regards
Prabhu

View 2 Replies View Related

Session

Feb 1, 2006

Does Session term exist in SQL Server?If yes, when it creates, how can monitor it. And where does itsinformation store?Thanks alot

View 1 Replies View Related

Return ID From SQL Into Session

Jun 5, 2008

How do you return the ID of an item to a Session in a ASP forum?
I have a MS-SQL Server 2005 database.
My table looks like this QuoteID, QuoteNumber, Date.
In SQL:
INSERT INTO table (QuoteNumber, Date) values ('123490WC1", '06/2/2008')DECLARE @ItemID INTSET @ItemID=IDENT_CURRENT('table')
What I would like to do is return @ItemID to the ASP forum; I assume Session would be the best.
After I get the @ItemID I have a Grid which I will to insert the Quote Items into.
Thanks,
marly

View 1 Replies View Related

Session Parameters

Jun 16, 2008

Hi, Can somebody tell me what's wrong with this statement or why the Session parameter is not working.
   <asp:SqlDataSource ID="datalist_SQL" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString2 %>"
SelectCommand="SELECT * FROM tbl_subProduct, tbl_material, tbl_product, tbl_subCategory, tbl_topCategory, tbl_topLevelProduct WHERE [tbl_subProduct].[numProductID] = [tbl_product].[numProductID] AND [tbl_product].[numTopLevelProductID] = [tbl_topLevelProduct].[numTopLevelProductID] AND [tbl_topLevelProduct].[numSubCategoryID] = [tbl_subCategory].[numSubCategoryID] AND [tbl_subCategory].[numTopCategoryID] = [tbl_topCategory].[numTopCategoryID] AND [tbl_material].[numMaterialID] = [tbl_product].[numMaterialID] AND @fldArray ">
<SelectParameters>
<asp:SessionParameter Name="fldArray" SessionField="ids_array" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource> Many Thanks

View 10 Replies View Related

Session Variable Help!!!!!

Oct 29, 2004

Hi...
I'm developing a web app with VS 2005 Beta and I do not know how to include a seasson variable value into my code.

This is my code:

Function GetData() As System.Data.SqlClient.SqlDataReader
Dim sqlconn As System.Data.SqlClient.SqlConnection
Dim SqlCommand1 As System.Data.SqlClient.SqlCommand
Dim sqlRdr As System.Data.SqlClient.SqlDataReader
sqlconn = New SqlConnection("SERVER=SRVR;UID=USR;Password=PWD;DATABASE=MyDatabase")
sqlconn.Open()
SqlCommand1 = New SqlCommand("MyStrProc", sqlconn)
SqlCommand1.CommandTimeout = 1800
sqlRdr = SqlCommand1.ExecuteReader(CommandBehavior.CloseConnection)
Return sqlRdr
End Function

MyStrProc is:

CREATE PROCEDURE MyStrProc
@MyVar int
AS
IF @MyVar IS NOT NULL
BEGIN
.................
......t12.acct_nbr IN (@MyVar)
.....
END
GO

The variable @MyVar get its value from user log info in login page, and create a session variable.

My Question:

How and where to call seasson variable @MyVar, because now I'm getting this error:
Procedure 'MyStrProc' expects parameter '@MyVar', which was not supplied.

Any help will be great.

Tks

View 4 Replies View Related

Get Data From SQL To Session

Jan 13, 2006

I'm new on ASP.NET 2.0Can anyone tell me how to get data from SQL to Session properties?
In Classic ASP, it looks very simple as below.dim connset conn = server.createobject("adodb.recordset")rssql = "select myid, mypw from mydb where myid = '"& request("myid") &"' and mypw = '"& request("mypw") &"'"set rs = conn.execute(rssql)if rs.eof = true thensession("myid") = rs("myid")session("mypw") = rs("mypw")end if
How to do the same things on ASP.NET?Many thanks!

View 6 Replies View Related

How To Find Session Id

Sep 1, 2006

How to find user session id in mssql

View 1 Replies View Related

New Session Inside SP?

Sep 16, 2004

Hi:

I want to open a new session/connection inside the execution of a stored procedure. Is this possible ?
I ask this because I need a new sesssion with its own transaction.

Thanks,
Rui Ferreira

View 6 Replies View Related

Session Variable

Jun 22, 2007

Can we use session variable in reporting services.. say go to report -> properties and create a VB function that get ans set session variable.. If yes, how. If not, any workaround?

View 2 Replies View Related

Terminal Session Name

May 9, 2006

Is there any way in stored procedure to find out a name of terminal session initiated connection to SQL Server?

Thanks for response

View 10 Replies View Related

Transactions Over Session

Oct 17, 2007

Hi guys,

I would like to manage the following:
BEGIN TRANSACTION;
SELECT * From SomeTable;
INSERT INTO SomeTable (SomeData) VALUES(12);
COMMIT TRANSACTION;

This should be easy usually. However, we need to have each row/command executed individually (using the SqlDataSource object in ASP.NET).

Is there a way how to make the transactions work over multiple executions?

Thanks,

Martin

View 4 Replies View Related

Asp.net Session Has Expired

Jul 11, 2006

Hi

I have designed reports using SQL Server Business Intelligence Development Studio tool (Sql Server reporting service). I have uploaded these reports to report manager.

I am displaying list of reports in tree view control, in my application. I am viewing report in Report Viewer control as per the report selection in tree view control, in same page. I am getting

Server Error in '/Application_name' Application or
ASP.NET session has expired error frequently while switching between various reports. Kindly provide me solution


.





Regards

Sagayaraj Rayappan

View 11 Replies View Related

New Value To A Existing Session Problems....

Jul 26, 2006

 
Ok, I am trying to teach myself asp.net and sql server. The problem I am having now is I want to update the session that already exists.  I have a global session (I think) that is UserEmployeeID, it is inputed when a user selects the select link on the search page which will redirect to an info page. I want to change the employee to a different employee, well I am updating the database well, no that is a lie it doesn’t that is another error, but anyway I try to update it to the new EmployeeID and it will not update…
 
Partial Class Assignment
    Inherits System.Web.UI.Page
 
    Protected Sub UpdateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UpdateButton.Click
 
        Dim empID As Integer
        Dim nbrID As Integer
        Dim equid As Integer
        Dim UpdateQuery
        Dim empequipid As SqlCommand
        Dim mySQLConnection As String = System.Configuration.ConfigurationManager.ConnectionStrings("DBConnectionString").ToString
        Dim myConnection As New SqlConnection(mySQLConnection)
        myConnection.Open()
 
        empID = CType(Session("UserEmployeeID"), Integer)
        equid = CType(Session("UserEquipID"), Integer)
 
 
        If CType(empID, Integer) = Nothing Then
            empID = (DropDownList1.SelectedValue)
            Response.Write("Insert: " & empID)
            'Response.End()
            Me.SqlDataSource1.InsertCommand = "INSERT INTO [EMPLOYEES_EQUIP] ([EquipID], [EmployeeID]) VALUES " & equid & " " & empID & ""
            Me.SqlDataSource1.InsertCommand = SqlDataSourceCommandType.Text
            Me.SqlDataSource1.Insert()
        Else
            empequipid = New SqlCommand("Select EmpEquipID From EMPLOYEES_EQUIP Where EmployeeID = " & empID & "  AND EquipID = " & equid & " ", myConnection)
            empequipid.CommandType = CommandType.Text
            nbrID = empequipid.ExecuteScalar
 
            ' Response.Write("Select EmpEquipID: " & nbrID)
 
            empID = (DropDownList1.SelectedValue)
 
            'Response.Write("<br>Update EmployeeID: " & empID)
 
            Me.SqlDataSource1.UpdateCommand = "UPDATE EMPLOYEES_EQUIP SET EmployeeID = " & empID & " WHERE EmpEquipID = " & nbrID & " "
            Me.SqlDataSource1.UpdateCommand = SqlDataSourceCommandType.Text
            Me.SqlDataSource1.Update()
 
            UpdateQuery = "UPDATE EMPLOYEES_EQUIP SET EmployeeID = " & empID & " WHERE EmpEquipID = " & nbrID & " "
            'Response.Write(UpdateQuery)
            'Response.End()
        End If
        Session("UserEployeeID") = (DropDownList1.SelectedValue)
        'Response.Write("<br>UserEmployeeID Session: " & Session("UserEmployeeID"))
 
 
        '-- Turn On Results Table
        resultstable.Visible = True
        '-- Hide Form by hiding table.
        maintable.Visible = False
        'clientSearch.Visible = False
 
    End Sub
End Class
 
I am also getting an error at Me.SqlDataSource1.Update() saying incorrect syntax near ‘0’ but there isn’t a 0??? I am confused…

View 1 Replies View Related

Set Session Variable From SQL Select

May 13, 2007

Hi,
I try to set a Session variable with the result of a SQL Selec statement. I tried the following, but it is not working.
Session("thisone") = SqlDataSource1.SelectCommand = "SELECT myfield FROM [mytable] WHERE ([username] = @username)"
@username is a value from a textbox. What I am doing wrong?
Thanks for your help, Chris

View 2 Replies View Related

Storing Session In SQL Server

Oct 4, 2004

I have some C# code that iterates through the session state, serializes each object and stores the binary representation in an SQL table with an 'image' column. The problem is: it doesn't work. SQL server doesn't throw an error (at least ADO.NET doesnt propagate it); the table is just left unchanged. The SP works (I tested it with a few simple values); the MemoryStream and byte array are being populated correctly and bound to the parameter correctly.

What am I doing wrong? Anyone have a better approach? I know there is a builtin way of storing state in an SQL server, but I only need to do this once--namely, when a user is redirected from non-secure to secure pages--so I don't want to take that performance hit,


string uid = _session.SessionID;
object toSerialize;
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream;

SqlConnection dbConn = SupportClasses.SqlUtilities.DBConn();
SqlCommand cmd;
SqlTransaction storeSession = null;
SqlParameter uidParam, keyParam, objParam;
try
{
dbConn.Open();
storeSession = dbConn.BeginTransaction();
foreach (string key in _session.Keys)
{
toSerialize = _session[ key ];
stream = new MemoryStream();
formatter.Serialize(stream, toSerialize);

cmd = new SqlCommand("store_session_object", dbConn, storeSession);
cmd.CommandType = CommandType.StoredProcedure;
uidParam = new SqlParameter("@uid", SqlDbType.VarChar);
uidParam.Value = uid;
cmd.Parameters.Add(uidParam);
keyParam = new SqlParameter("@object_key", SqlDbType.VarChar);
keyParam.Value = key;
cmd.Parameters.Add(keyParam);
objParam = new SqlParameter("@data", SqlDbType.Image);
objParam.Value = stream.ToArray();
cmd.Parameters.Add(objParam);

cmd.ExecuteNonQuery();
}
}
catch (SqlException ex)
{
SupportClasses.ErrorHandler.HandleSQLError(ex);
storeSession.Rollback();
}
catch (System.Runtime.Serialization.SerializationException exs)
{
// do something
}
finally
{
dbConn.Close();
}


For those interested, here is the code for the SP:

CREATE PROCEDURE store_session_object
@uid varchar(50),
@object_key varchar(25),
@data image
AS
INSERT INTO session_hold (uid, object_key, object)
VALUES (@uid, @object_key, @data)


[Cross-posted because issue spans several topics.]

View 2 Replies View Related

Sql Server Mail Session

Jan 18, 2002

when i start mail session
there is a message poping up as
"Error 17952:Faild to Start SQl Mail Session"

When i test From Sql Mail Configuration
i get a message "succesfully Started(and stopped)a MAPI session with this profile"

& still i cannot start the sql mail service"
i still get a error

what could case for this error

View 1 Replies View Related

Session Idle Timeout Over

Jun 18, 2001

Hi all,
We got this message on our production server event viewer for source MSDTC.

"String message: Session idle timeout over,tearing down the session"..
Even though it is marked as informational, just wanted to know what it is?..

thanks guys,
Marx

View 1 Replies View Related

ALTER SESSION Query ?

Jul 27, 2004

Hi,

What is the equivalent for below Oracle's ALTER SESSION query :

ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:mi:ss'

Thanks,
Sam

View 1 Replies View Related

Session Browser In SQL Server

Jan 30, 2008

Hey,

Does SQL Server have a session browser similar to Oracle and if so, how can I use it? I am looking to retrieve the SQL being ran when users are running particular reports from a gui tool.

Thanks

View 1 Replies View Related

Monitor Data Per Session - Available?

Jul 20, 2005

Hiya!I've combed the SQL Server 2000 online help but I don't see anythingakin to Sybase ASE's 'montor' views - equivalent to Oracle's V$views. The views are performance views which contain per sessioninformation such as:- SPID- number of logical read/write and physical read I/Os accumulatedthus far- CPU accumulated- Memoryetc.Does anyone know if I can snarf that data from SQL Server 2000?Thx!--Pablo Sanchez, Blueoak Database Engineeringhttp://www.blueoakdb.com

View 3 Replies View Related

Session Memory Usage

Jul 20, 2005

Hi,does someone know how much memory a user session takes on a SQLServerdatabase server? How many concurrent user sessions can a normal server(4 GB primary memory) handle, before connection pooling is needed?/Fredrik

View 2 Replies View Related

Instance , Session In SQL Express

Jul 24, 2007

Sorry but i need to know even it's very easy for all :


what is a session?

what is an instance?

if i use SQLExpress how meny people will be allowed to connect in same time to dataBase.?

is there another free DBManager, but is it better than SQLExpress?
thanks.

View 5 Replies View Related

Session Increasing Indefinitely

Aug 5, 2015

I`m using IIS7..At present, our company has come not a difference indeyo of operating the server using Classic ASP recently we met a big problem : session is increases indefinitely. 503.3 - ASP.net has a queue is full. The phrase occurs continuously. Is there any solution for check problems? or how can i see what source code page makes the problem (ex. 123.asp : session 300. 234.asp : session 4000).

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved