Unable To Access Session State From Class?

Jul 2, 2010

I have a Dynamic Data application to which I have added a class for extending EDM. Everything works great, but now I am trying to set an entity property value equal to a value in session state - and its not recognizing the Session command. I'm trying to do something like this:

audit.action_by = CStr(Session("person_name"))

I think this is because I do not have the class Inheriting Page, but if I do add Inherits Page it breaks other stuff. How can I have the class include the ability to utilize sessions directly without inheriting Page?

View 2 Replies


Similar Messages:

State Management :: How To Access Session Variable In The Class

Mar 27, 2010

How to access session variable in the class?

View 5 Replies

Web Forms :: 3.5 Error: Unable To Make The Session State Request To The Session State Server?

Dec 7, 2010

Have not run the ASP.NET Development Server for a while. Today I copied a production website to my workstation and ran it with VS 2008. The following error message popped up. What is the problem with the ASP.NET development Server on my workstation? The website on the Production server still ran okay.Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection.
If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

View 2 Replies

State Management :: Unable To Serialize The Session State In 'StateServer' And 'SQLServer' Mode

Dec 12, 2010

I am new to .net 4.0 and am using EF Model and SessionState Mode=SqlServer and I am getting this error below:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

I checked the stack trace and its complaining about

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("PoplarGroveModel", "tblMenuRole", "tblMenu", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(PoplarGroveDataModel.Menu), "tblRole",

[Code].....

I marked it as serializable but then it complains about System.Data.Objects.ObjectContext is not marked as serializable and hence throws the same error.

View 1 Replies

State Management :: Unable To Make The Session State Request

Apr 21, 2010

Our Web Server rebooted due to power failure. Now ASP.Net State service would not start logging the following error on the server:

Unable to make the Session State Request to the session state server. Last known phase=Sending request to the state server

how to bring back the ASP.Net State service.

View 2 Replies

Unable To Get The Session Values In Class Library?

Nov 12, 2010

I have added objects to the session state in an aspx page which is using an object datasource.I want to get the session value in the class library which is used by the object datasource.

code in class library

selectedrelease = HttpContext.Current.Session["selectedbuild"].ToString();

code in aspx page

HttpContext.Current.Session["selectedbuild"] = TreeView1.SelectedNode.Text;

However i am not able to get the session value in class library

View 2 Replies

Unable To Serialize Session State

Dec 11, 2013

Getting error when trying to save structured arraylist into session Variable (see btnTS_Click below)

Code works on my desktop VS2012 devel system but not when posted to webserver we use.

Try It: [URL] ....

Code:
Public Class _Default
Inherits System.Web.UI.Page
Structure HoursData
Dim Project As String

[Code]...

View 9 Replies

State Management :: Unable To Locate The Class SqlCacheDependency As Per This MS Article

Jan 31, 2011

http://msdn.microsoft.com/en-us/library/system.web.caching.sqlcachedependency(v=VS.90).aspx

I could not locate the class SqlCacheDependency as per this MS article!

View 2 Replies

Unable To Serialize Session State - Server Errors

Oct 14, 2010

We have been receiving reports of the following server error periodically from users.
[OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.]
[HttpException (0x80004005): Unable to serialize the session state.]
Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is "StateServer" or "SQLServer".

Once in a state where this error appears, it appears to be hit or miss whether the errors are reproducible locally. If they are, then we can usually reproduce them for a couple minutes, but not on every page hit. This usually tapers off on its own and usually has resolved itself by the time we get back in contact with the users. The Web Service has around 90-100 active connections during business hours. The only other site on this server is the staging version of this site, which gets hit very infrequently. The Session State is stored on the same SQLServer instance as the application database which is housed on a fairly large cluster of virtual machines.

Neither the Web Server or the SQLServer seemed to be taxed (either processor or memory-wise) while this is going on. The distribution of which pages are erroring seems to be comparable to the normal distribution for each page. There doesn't appear to be any pattern in terms of times of occurrence. We do have less errors on average on weekends (which correlates to normal site load), but even this appears to not be consistent. There also doesn't appear to be a correlation between the errors logged and any kind of logged performance monitor events. This includes an array of perfmon counters including:

.NET CLR Jit(w3wp)
otal # of IL Bytes Jitted
.NET CLR Jit(w3wp)IL Bytes Jitted / sec
.NET CLR Jit(w3wp)\% Time in Jit
.NET CLR Jit(w3wp)# of Methods Jitted
.NET CLR Jit(w3wp)# of IL Bytes Jitted
ASP.NET Apps v1.1.4322(__Total__)Requests Failed
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution/Sec
ASP.NET Apps v1.1.4322(__Total__)Errors Unhandled During Execution
ASP.NET Apps v1.1.4322(__Total__)Cache Total Turnover Rate
ASP.NET Apps v1.1.4322(__Total__)Errors During Preprocessing
ASP.NET Apps v1.1.4322(__Total__)Errors During Execution
ASP.NET Apps v1.1.4322(__Total__)Requests Executing
ASP.NET Apps v1.1.4322(__Total__)Requests Total
ASP.NET Apps v1.1.4322(__Total__)Errors Total
ASP.NET Apps v1.1.4322(__Total__)Sessions Abandoned
ASP.NET Apps v1.1.4322(__Total__)Errors Total/Sec
ASP.NET Apps v1.1.4322(__Total__)Anonymous Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Requests/Sec
ASP.NET Apps v1.1.4322(__Total__)Session SQL Server connections total
ASP.NET Apps v1.1.4322(__Total__)Cache Total Hit Ratio
ASP.NET v1.1.4322Requests Current
ASP.NET v1.1.4322Request Execution Time
MemoryPages/sec
Bytes Total/sec
PhysicalDisk(_Total)Avg. Disk Queue Length
Processor(_Total)\% Processor Time
Web Service CacheFile Cache Hits %
Web Service CacheFile Cache Misses
Web Service CacheFile Cache Hits
Web Service(_Total)Current Connections
Web Service(_Total)Post Requests/sec)

The only pattern I can see in the logs doesn't correlate to the occurrence of these errors, but is the only pattern I can see. Looking at the perfmon logs we are seeing a pattern where the "Total # of IL Bytes Jitted", "IL Bytes Jitted / sec", "% Time in Jit", "# of Methods Jitted", and "# of IL Bytes Jitted" counters for the staging site (which shouldn't be getting any traffic) doesn't pull data for a 20-50 minute period after which there is an immediate spike in "IL Bytes Jitted / sec" and a jump in "% Time in Jit" for 2-20 minute of up to 99% for the main site.

View 1 Replies

C# - Unable To Share Session State Between 2 Web Apps With StateServer?

Jul 20, 2010

I'm having trouble getting 2 identical ASP.NET MVC applications to share the same Session using a Session StateServer. The reason I'm trying to do this is we will eventually be deploying this app across 3 web servers that need to share the same state. We need to use StateServer because we are trying to minimise use of the db for non data-related storage.

The Setup: I've deployed the same code base to http://localhost/App1 and http://localhost/App2

both have identical Web.Config files with the following:

<system.web>
<sessionState mode="StateServer"
cookieless="false" [code]....

The Result:For both deployments, when the page first loads I can see that the mode is StateServer and the timestamp is getting set to the same time as the realtime value.. However, if this was working, only the first page should have the same time as the realtime value. The second page load should read from the StateServer because that timestamp value is no longer null, and display that time value. But instead, it's displaying the realtime value again.

When I refresh the page, I the timestamp stays the same and the realtime value is always updating. This indicates that the timestamp is being saved to the Session, but the time stamp value is always different for both deployments when it should be the same, so this indicates that the Session is not being shared.

View 4 Replies

State Management :: Unable To Retain Session Variable?

Jun 17, 2010

We are setting session variables in the login page with all user details.And in all subsequent pages we check this session variable.This check is done in the page load of master page.As the number of users increased am getting error with these session variables.This session variable is returning me "nothing" when I check and the user is redirected to logout page.Interesting thing is that this is not happening always.

View 2 Replies

State Management :: Can't Retrieve Session Object From Class

Jun 30, 2010

my solution currently has a website project and a class library project. I am attempting to access a session object from my class library but it is always returning null. In a settings class in my class library I store these values like so:

private static SessionProperty<WebUser> _currentUser = new SessionProperty<WebUser>("CurrentUser", delegate { return new WebUser(); });
public static WebUser CurrentUser
{
get { return _currentUser.Value; }
set { _currentUser.Value = value; }
}

I can access this just fine from any aspx page codebehind like so:

Settings.CurrentUser.User.ProviderUserKey.ToString();

However, if I attempt to do the same thing from a class in my classlibrary project it always returns null.

View 5 Replies

Web Forms :: Unable To Access/run Code In Class Files?

Nov 9, 2010

I have a Web Site project running on VD2008, with an Access back end and .NET 3.5, C#.

I have created the project several times and added the usual App_Code, Pages, App_Data, Properties, folders. I created a Master Page and several content pages BUT I am unable to get to the folders or root where there is a Class (code) file.

I have tried all the usual lines...

using SumaCard.App_Code

OR

SumaCard.App_Code.FTP_Code ftpc = new SumaCard.App_Code.FTP_Code();

but nothing works? I have been hasseling over this for 2 days now.

What have I missed? Maybe I built the project wrongly? (Project | New Project | Visual C# | Web | ASP.NET Web Application |??

View 2 Replies

State Management :: Session Used In Thread Class Return Null

May 5, 2010

I want to use session in thread class but it return null in parent that is the page class.

View 4 Replies

State Management :: Session Or Request In Class Without Passing As Parameter

Sep 3, 2010

I'd like to be able to reference the asp.net objects Session, Request, from a procedure without passing them in as parameters all the time. Is there a way to do this. For example, now I have

[Code]....

I'd like to call it like this "ContextPT.GetSession()" and have GetSession know how to find the Session object. I know this does not seem like a big deal in this case, but I have reasons.

View 1 Replies

State Management :: What Triggers SessionStateModule Class To Start A New Session

Apr 20, 2010

SessionStateModule raises a Start event with a new seesion. Is there a pointer to "deep dive" information?

In particular,

(1) I want to preserve Session state information across a postback to external (web-based) services in my VS 2008 development environment, but am finding that my code is triggering the creation of a new session.

(2) I am using IIS to host WCF Service calls, and it appears that many of those calls trigger the creation of a session. I would like to dive deeper into this, and try to manage (reduce) the number of sessions that are created and their behavior.

View 3 Replies

State Management :: Serialize/Deserialize A Custom Class In And Out Of A Session

Mar 18, 2011

I'm trying to save a custom class in a session, but it just never gets saved, along with other sessions. Note that my SessionMode = STATESERVER, and i cannot change it to INPROC as per our business requirement. This is my class

/*******START*******/
[Serializable]
public class User : ISerializable
{
private int _userId;
public int UserId
{
get { return _userId; }
set { _userId = value; }
}
//custom class
private TDB.tdbUser _tdbUserDetails;
public TDB.tdbUser tdbUserDetails
{
get { return _tdbUserDetails; }
set { _tdbUserDetails = value; }
}
//collection of custom class Sites
private List<Sites> _assignedSites;
public List<Sites> AssignedSites
{
get { return _assignedSites; }
set { _assignedSites = value; }
}
public User()
{
//Constructor code
}
/******SERIALIZATION*****/
protected User(SerializationInfo info, StreamingContext context)
{
this._userId = (int)info.GetValue("_userId", typeof(int));
this._assignedSites = (List<Sites>)info.GetValue("_assignedSites", typeof(List<Sites>));
this._tdbUserDetails = (TDB.tdbUser)info.GetValue("_tdbUserDetails", typeof(TDB.tdbUser));
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("_userId", this._userId);
info.AddValue("_assignedSites", this._assignedSites);
info.AddValue("_tdbUserDetails", this._tdbUserDetails);
}
}
/*******END*******/

The calling code is just this: (User)HttpContext.Current.Session["TDBUSER"];

View 2 Replies

State Management :: Cant Access Object Property In Class?

Mar 28, 2010

I'm having a problem with a class library I'm building. I have a class called Users and inside this class I have a property called UserInfo that is an object. Both of the classes Users and UserInfo are built using MyGenerations dOOdads. When I create an object instance of the Users class I am able to access the UserInfo property without a problem in my Windows App, however when I using the same library in a website the UserInfo property continues to return a no reference error. Like I said when running it in a WinApp I have no problems at all, I can access the UserInfo property and likewise all of UserInfo's properties. I am also having problems trying to debug the library using the website. And again I have no problems when using the WinApp. The way I've set it up is I have the Class library project open, and then I add the WinApp project and then the website project. When I set the WinApp as the startup project and run it I have no problems, I can set breakpoints and step through the code no problem. But when I set the Website as the startup project and try to debug I get a massage saying the breakpoint won't be hit. I then do what it tells me and right click on the breakpoint and set the location to allow the source to be different. This lets me hit the breakpoint, but every time I hit F10 to step I get "There is no source code available for the current location." For every step I take. This is making it really hard for me to figure out what going on with the code in the website. Sorry for the lengthy explanation. Here's the Users class, again it works great in the WinApp, just not the website.

[Code]....

View 6 Replies

Access Session / Cache From Class In App_code?

Feb 8, 2010

Is that possible to get access to Session, Cache, Server.MapPath() from a class in App_code?

View 1 Replies

How To Access Session Object Outside The Web Project (class Library)

Oct 29, 2010

I am implementing a custom membership and role providers where I need to store all the role/membership information in the user's session.

I am implementing these custom providers inside a class library project (different from the website project) and need to access the session in them. The idea is to store the role/membership related information in the session after retrieving them for the first time from the database.

When I try to access the Session using System.Web.HttpContext.Current.Session

I get this as a null object (Object reference not set to an instance of an object.

Why is the session turning out to be null?

View 1 Replies

Class Access Session Object But Not When Deploying It To Server?

Mar 16, 2011

I have a custom MembershipProvider that I'm using in an ASP.NET 2.0 application. Inside of the class that extends membership provider, I have a function called AttemptLogin() that sets session variables if the user is valid. Inside that function, are a number of session variable assignments similar to the following:

HttpContext.Current.Session["id"] = "12345";

AttemptLogin() is being called by the Application_BeginRequest function in global.asax. This code works fine when I open it in visual studio, and then run it in the built-in development server by clicking "Start Debugging". However, when I deploy it to our testing server (Windows 2003 Server 64-bit running IIS in 32-bit mode), execution breaks when it reaches the code above, giving me the following message:

[NullReferenceException: Object reference not set to an instance of an object.]
CustomMembershipProvider.AttemptLogin() in c:InetpubwwwrootJoshApp_CodeCustomMembershipProvider.cs:1097
ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in c:InetpubwwwrootJoshGlobal.asax:14
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

How can I access the session state successfully in this situation? Why does it work locally and not on the server?

View 2 Replies

State Management :: Access Session Variable?

Jul 18, 2010

I have two projects ,one is webforms and other is Business logic, i am storing username in Session Variable, i have audit module in businss logic which has event handlers to do auditing on object create / remove. i want to store username in audit trail, i want to save username in some global place which is session bounded so that i can get the username in my audit module.i dont want to refer System.web, or httpcontext in my businesslogic project.pls help how i can acheive this. i found this article but cudnt understand much.

"Now one option if you want to have your DLL pull the stuff from Session is to abstract out session. So you could define an interface like IStorage, that your library will know how to use. Then you can have a SessionStorage or MemoryStorage class and use IoC to inject the appropiate class into your library classes. This gives you the freedom to code it how you wanted it to be coded without tying your code to Session. Oh and one other benefit if done properly can be used to not tie your code to session in the web either.

View 7 Replies

MVC :: Access HTTPContext And Session From Custom Base Controller Class?

Jan 13, 2010

I built a base controller class inherits from Controller class to add some custom behavior to all controllers which will inherit from this base class.

My issue is when I try to access HTTPContext and Session objects in my custom base class, they are always null.

Am I doing something wrong or need missing something?

My custom base class definition:

public class ApplicationControllerBase : Controller

controllers classes definition:

public class HomeController : ApplicationControllerBase

using ASP.NET MVC 1, .NET 3.5.

UPDATE:

It seems the issue is I try to access HTTPContext in the constructor while HTTPContext is not ready yet, I tried it in the OnActionExecuted event handler and it works fine.

My question is what is the best place to access Session object in my custom controller class, that will guarantee executing my code with all controllers.

View 3 Replies

How To Access A Simple Session State Variable From Any Page

Jun 24, 2010

how can I access a simple session state variable from any page?i would think to use: session("variableName")but that just doesnt work....

View 3 Replies

State Management :: Concurrent Access To Session Object

Mar 30, 2010

I am stuck with the issue of concurrent access to Session object. Actually my problem is i m writing to session in frame1 and trying to access that same Session object at the same time in Frame2's Page. I know about the reader/writer lock. I made the enablesessionstate = readonly in the page where i m writing to session. its giving me strange behavior on IE and firefox.

Its working concurrently in IE8 ( means page2 is diplaying modified values while page1 is changing the session object) but does not work in Firefox even page load is not called untill function on page 1 completed. Either anyone can fix my issue with firefox or there is new solution to reader/writer lock so that i can read the session at the same time while writing.

View 2 Replies







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