I'm trying to convert a game I made (WindowsFormApplication) to an ASP.NET page.
My Problem is that I have a lot "private" variables in my WindowFormApplication and those variables are important for the game. But when after I Declare all my variables (in my Page_Load), they turn null no matter what I do(click a button, refresh the page).
Is there anyway to save my variables between buttons (other than Session, because I'd have to create like 6 more sessions)
I am developing an application using Visual Studio 2010 and SQLServer 2008. My application has two pages and the first page contains a GridView with all the records "User Administration" and when user click on any Username (template field ->linkbutton) I read the USERID like this.
which takes it to the Data Entry page where user updates the information and save the data.
The problem i am facing is that when I hit the browser REFRESH button couple of times the session variables looses the value which is trouble for me as I am using Session Variables for different purposes.
This means I've lost the ability to set my session values on postback. Can anyone think of a solution for setting these before I post my form? I need to set the session variables, plus post (querystrings are not an option) to the external page with the values from my form - and actually send the user to the external page, too.
In above code I am having a Session["panelOpen"] variable which is created from another user control and once my page is trying to render, I am storing Session["panelOpen"] in my hidden lblPanelOpen.Text on page OnInit() method, however when page is loaded completely then I am trying to remove the session variable.
I'm using the beta version of Visual Studio 2010. I'm running my ASP.NET 4.0 website through the debugger. Whenever there is a page load (e.g. clicking on a link, a postback) the session is ended and a new session is created. This wipes out all the session variables and makes debugging impossible. How to get session variables to persist across page loads?
Is this problem unique to running ASP.NET in a test environment or unique to the beta 2 version of VS 2010?
I have a web application that contains a MasterPage and a Web.sitemap file for the navigation. I am loading the navigation into an <asp:Repeater> control and I associating it with <asp:LinkButton>; something like this:
I have two issues:
Setting Session Variables: I'd like to set some session variables when any menu item is clicked.Dynamic Url: Once the Session variables are set, I'd like to set the url dynamically after the Session variable is set The thing is, I'd like to use the same aspx file for two different menu items, and I'd also like to set some session variables at the time of menu selection. I am aware that I cannot use the same url when I define the url in the web.sitemap file.
I'm trying to set session variables in one page, and retrieve them in my code file in the page that it posts to.
I keep getting this error. I put the correct namespaces in, and enabledSessionState = true to my application files, but no luck.
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration.
I'm just calling a session variable, and I get that error
Public AUID As Integer = Convert.ToInt16(Session("AUID"))
I have an webforms app that loses it's session variables on response.redirect. I've read Bertrand Le Roy's blog about this and still can't get it to work. The page works in production. However, when I try in the VS2k8 IDE, the session variables are there right before response.redirect and on the first line of the next page, the variables are nothing. I've confirmed the session id is the same so I'm not skipping sessions. The target page is relative so the web server doesn't think we're changing sites (as confirmed by the sessionid).
I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...
The same website runs smoothly in our production server too....The problem is with our development server...
I have some code in my page load event where I just want to fire once when the user opens the Browser. The only issue is if you open a new tab with the same website the session variable does not reset. Is there a way to reset the session variable when you open a new tab or do you have to take the whole web browser down for it to clear the session variable.
There are reams of info out there about things causing InProc session to drop session objects, but that's not what's happening here. We're missing individual variables within stable InProc session objects, and are not sure whether they're not being written or being lost after a successful write. I've confirmed with WinDBG that the sessions are live and contain some, but not all, of the data written to them.
This code is pretty straightforward, and it works flawlessly in Test. In Production, under heavy load, though, it fails ~1% of the time. If Mr Smith visits the site and attempts to display 4 pieces of image data, 2 of them might be saved in his session and two of them be lost. The InProc session object for Mr. Smith exists. The traffic logs show he clicked 4 times, each with a different id param. But there are only 2 guids in his InProc session object, instead of 4. The 2 session objects we did capture do correspond to 2 of the id's shown in the traffic log (his 1st and 3rd clicks.) The traffic logs for his 2nd and 4th clicks, though, show a guid id that's not in his InProc session object.
Lines 1&3 of the above code obviously worked for those 2nd and 4th clicks, or he'd not have had the id in the URI for him to click. Line 2, however seems to have failed silently in some way. If any exception had been thrown, I'd expect we'd not ever have arrived at line 3. I can't see any way for the user to receive the guid id, but the session to fail to have it. The other possibility is line 2 worked successfully, but the variable later disappeared, how I cannot even imagine.
Details: ASP.NET v3.5 IIS 6 No Web Gardening
We're running a web farm, but users constantly return to the same server. I'm researching now whether there's any way users might be slipping off to the other server.
Am trying to design login page for my website and I am looking for methods other than forms authentication. The way in which I am trying is to have a table in the database that stores user information and check for the user validity.
The point where I get struck is how do i set cookies and session variables and how will I carry it through out the system. Can anyone tell/suggest me where I can relevant material so as to move forward. And also is my idea of negating traditional forms authentication and going for a model I described, is it good also does any other better method exist?
I want to password protect an area of a website by a login/registration form.
I'm using session variables to check wheter the user is logged in or not. I already have a database with users/passwords... so I thought that the membership approach wasn't an option... (correct me if I'm wrong)
in the constructor of the controller of the area I want to protect I've added the following:
but this throws an error:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace or more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Line 28: this.productsRepository = productsRepository;Line 29: Line 30: if (Session["user"] == null)Line 31: RedirectToAction("List", "Products");Line 32: }
In my .NET web app, I keep basic user info in a user session object. I also usually keep a director class in the session; which is basically just has info about whatever thing it being worked on on that screen (like a customer id).
I am trying to keep from adding a ton of sessions. I also want to make sure at any given time ONLY the sessions that are necessary are in memory.
This means I need an effective way of managing my session variables.
I have a situation where my session variables seem to get corrupted. I Page_Load I am calling 2 subs. Each of them fills a GridView with data from a table. I am saving the content of each Data.DataTable into Session Variables:
After I call the 1st sub and I debug the session variable "mySqlDataTable1" contains all the data from the table. After I call the 2nd sub and I debug the session variable "mySqlDataTable1" has been changed and contains a mix of data from the 2 tables.
I'm trying to pass some variables from one page to another via the session state and then post those variables to labels on page 2. When I try to write the code for my labels on page2, I get an error of "Declaration expected"Here is my code from that page:
Partial Class Default2 Inherits System.Web.UI.Page Dim firstname As String = CType(Session.Item("FirstName"), String) [code]...
Am I missing a page_load event handler or what am I missing?
I am doing web based projects in dotnet. Currently I am implementing security using session variables. I keep current user id and user type in session and authenticate user from these session variables (say Session["UserId"],Session["UserName"] and Session["UserType"]).
I've heard that such security can be broken and applications can be hacked very easily, like it is possible to get session id and directly connect to that session id etc.
I have an ASP.NET application with 5 .ashx HTTPHandlers that implement RequiresSessionState or IReadOnlySessionState.Upon calling the first handler I create a variable and store it in the session.When I call the next HttpHandler the variable is not available in the session object.I am use context.Session.I have a global.asax where I retrieve the sessionId.Is there a way to preserve session variables across HttpHandlers or does each Handler get its own session?
I am having with asp.net app inside of SharePoint (as page viewer).
When the Default page is loaded, it works fine. However, when I try to go to next page, i am getting a null reference exception. It looks like my session variables are becoming null on the next page (even though I set them on the previous page). Here are a couple things that I tried to diagnose the problem.
I try on the couple other computers; some work fine, some still don'ts. In the property of the page viewer inside of the SharePoint, after I click on the "Test link", it started to work fine until the session expired (on the computer didn't work initially).
I am not sure if there are settings that I need to check on the browser or the app server.