Question Regarding Storing Session With Set Context_info
May 10, 2006
Currently our need is to track the data that is changed by the user and record it as a part of the Audit Log.
We have accomplished this need ny making use of set context_info and also by passing the UserId from all the Layers and finally log the user name using the set context_info in the stored proc.
What we thought of was using the trigger for each update,delete records for the table.So by setting the context in teh stored proc we could access the UserId in the trigger and able to record the changes made by Tagged userId.
What we want to make sure before making this as our permananet solution is
(1) Reliability - In a web application (N Tier) how would the context not get out of scope.
2) any Performannce related issues, you guys can think of.
3) This Context used in the database -- would that be the part of the connection used from the UI, meaning the if a request is made from UI to the Database . would the context be alive till the connection doesn't go back to the connection pool.
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,
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?
declare @x varbinary(128) select @x = convert(varbinary(128), 'Some user name') set context_info @x
Then in a trigger, you can say:
UPDATE tbl SET who_was_kilroy = convert(varchar, p.context_info) FROM inserted i JOIN tbl t ON i.keycol = t.keycol CROSS master.dbo.sysprocesses p WHERE p.spid = @@spid
I am searching for a more generic way (varbinary 128 is not big enough) to store and access connection wide variables
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?
Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?
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..
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
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
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.
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!
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.
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?
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
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()
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
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.
HiCan anyone help me with Session Management in ASP.NET. I have a webapplication with a login page and i need to retain the username afterhe logs in. This is what I have in Config FilesGlobal.asax<OBJECT RUNAT="SERVER" SCOPE="SESSION" ID="MyInfo"PROGID="Scripting.Dictionary"></OBJECT>web.config<configuration><!-- This section stores your SQL configuration as an appsettingcalledconn. 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 formsauthenticationand routes all traffic to the specified page. It alsospecifies atimeout. The authorization section below denies all users notauthenticated. For testing purposes, custom errors was turnedoff.The section below allows pages to be trace enabled fordebugging--><system.web><sessionStatemode="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 workssession("username") = txtUsername.TextBut if I use a new session variable or the username(session variable asdeclared in the login page, in the menu page it gives me error sayingthat Decralation is expected . Is there any files that i need to importb4 using sessions??Please help me out. My email:bramanujam@gmail.com
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
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
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).
I have a master package that executes a series of sub packages. The master package is run from a SQL Agent job. The packages are reading from and writing to two databases on the same instance of SQL Server 2005.
If I set the Execute Package Tasks for the sub packages without any precedence constraints between them and set TransactionOption = Required at the master package level (and supported from there downwards) I get the following errors.
The event log shows me:
The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D00A "Unable to enlist in the transaction.".
Running a SQL Profiler trace shows me:
Error: 3910, Severity: 16, State: 2 Transaction context in use by another session.
This problem is well documented and seems to go back to DTS in SQL Server 7.0 . . . see http://support.microsoft.com/?scid=kb;en-us;279857&spid=2852&sid=150
I can get round it by setting precedence between the sub packages - making them run one at a time solves the problem. But then we don't get the performance benefits of running the packages concurrently. Does anyone have any other solutions.
This procedure has a begin trans and a commit. In this procedure i'm inserting data into tables. This data is provided by an extrenal app in staging tables. On the tables i'm inserting data on i'm having triggers that again are starting a SP2. I'm using a cursor on the inserted table to achieve this. The SP2 only insert a record on a table that is on a linked server.
For testing reasons at this moment this is my dev machine too.
We've implemented mirroring between two identical servers. Sporadically, the mirroring session will drop and the ERRORLOG reflects the errors below at the exact time the mirroring session becomes suspended. We do not manage our back end network since we use a dedicated hosting environment at a remote location. Is this issue solely caused by network connectivity issues, or are there other factors at work?
2007-07-16 04:24:37.24 spid23s Error: 1453, Severity: 16, State: 1. 2007-07-16 04:24:37.24 spid23s 'TCP://192.168.215.92:5022', the remote mirroring partner for database 'evestment', encountered error 1204, status 4, severity 19. Database mirroring has been suspended. Resolve the error on the remote server and resume mirroring, or remove mirroring and re-establish the mirror server instance. 2007-07-16 04:24:48.46 spid23s Error: 1479, Severity: 16, State: 1. 2007-07-16 04:24:48.46 spid23s The mirroring connection to "TCP://192.168.215.92:5022" has timed out for database "evestment" after 10 seconds without a response. Check the service and network connections.