Web Forms :: Limitations In Using Viewstate And Session Variables
Jul 17, 2010
i have deployed my website on a particular server. i have some limitations in using viewstate and session variables. those pages in which i have used ViewState variables (for storing some information), i user accesses that page and does not do any activity for 5 minutes and if after 5 minutes he does any kind of activity (click on Link or button etc) then he receives following error: "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."
how i can avoid above error? another problem is with session. My session expires just after 2-3 minutes. What should i do for maintaining session for long time? i can not use cookies, as if user has disabled the cookies then my website will not work...
View 2 Replies
Similar Messages:
Aug 8, 2010
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
such :
<a href="javascript:;" onclick="wsChangeColor('mainData', '#FF0000','#FFE4E1');return false;" title="Change color" id="red">1</a>
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
View 1 Replies
Oct 11, 2010
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...
View 2 Replies
Nov 11, 2010
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.
In Global Page:
[code]....
View 2 Replies
Nov 12, 2010
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.
Guid g = System.Guid.NewGuid();
this.Context.Session.Add(g.ToString(), result.ImageData);
output.Write("<img src="display.aspx?id=" + g.ToString() + "">");
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.
View 2 Replies
Jul 27, 2010
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.
Session["UserID"] = e.commandArgument;
Response.Redirect("UserOperations.aspx");
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.
View 10 Replies
Oct 8, 2010
I have an asp.net website in which users can submit reports. Another tester and I tested this page at the same time and when I went to review the information I submitted, it displayed information that I didn't submit. It displayed the info submitted from the other user.
I use session variables for these values. I don't understand how this happened? What can I do so each user can individually submit their information without overlapping some one else's information? The plan is for multiple users to be able to use this page to submit their weekly layer reports.
The first example of code is how I add the session variables from the textboxes.
[Code]....
The second one is how I display them in labels on a confirmation page.
[Code]....
View 16 Replies
Jun 15, 2013
When user log's in with it's emaild and password, I have stored it's email id in session variable as: Session("user"). After logged in, If i leave the page kept opened OR ideal for sometime and after thatt if I select any option from user profile, the session variable get expired and send's me back to login page. I want that if I would create 2 to 3 session variable's it should remain activated for longer period. So that even if page kept ideal for longer period and then if selects any option, the session variable's should not be expired soon.
View 1 Replies
Feb 5, 2010
I am designing a site with that requires users to login in to access info. How do I save the user name and password in viewstate or session. so I can use it in other pages later.
View 2 Replies
Aug 17, 2010
I have an app which has a form that used to use AutoPostBack rigged controls (dropdowns, radiobuttons etc.) in an updatepanel, and I used to set session values on each postback. I posted the form using PostBackUrl to an external page, using a bit of javascript OnClientClick to copy my data into meaningfully named hidden fields.
Now, I've had to rewrite the AutoPostBack-ing controls so that all the cascading dropdown work and date calculation etc. is done in JavaScript, and not in C# - no more postbacks, no more updatepanel.
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.
View 2 Replies
Nov 27, 2010
I can get selected values from my first page with session. In my second page i want to populate product details side by side in listview with this values. How can i do it?
here is my seconde page code behind in VB
[Code]....
View 8 Replies
Jul 6, 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:
[Code]....
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.
View 2 Replies
Apr 30, 2013
if i want to get multiple values from database and pass this dataset to another page can we use session to store the dataset values..i knw we can..but some one says that its not a gud approach..this will cause server process down..is it true?if it so then wat are all the other ways to do that?
View 1 Replies
Oct 26, 2010
If I have a 2 control load events and one page load event subs and the control1_Load events fires first, can I lookup some database things and persist them? I would like to use the persisted data in the other two events when they fire. Normally I've been using session variables , is there a better way?
View 3 Replies
Nov 28, 2010
i have a first page and user selecting some products. Passind with session. Retrieving from first page. And in this point i want to connecting my northwind db and display selected products detail side by side in my second page. (listview or datalist) here is my second page codebehind.
[Code]....
View 3 Replies
Dec 24, 2010
Where exactly are session variables saved? Cookies? Server memory? Again where are Application variables saved?
View 3 Replies
Mar 22, 2010
I need to clear all sessions at the end of my application, to many to list individually.
So I have found the following ways, but which is best?
Session.Clear();
Session.Abandon();
Session.RemoveAll();
And then the specific way
Session.Remove("variable");
View 5 Replies
Jan 27, 2010
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?
View 1 Replies
Jul 30, 2010
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:
[Code]....
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.
Source Error:
[Code]....
Line 28: this.productsRepository = productsRepository;Line 29: Line 30: if (Session["user"] == null)Line 31: RedirectToAction("List", "Products");Line 32: }
View 2 Replies
Nov 10, 2010
I am working on an asp.net mvc app.Right now I am looking for the best solution to access session variables.
Is it oke to make a static class to get session variables, like:
[Code]....
And so on for other session variables.Is it allowed to access session variables in static model classes ?
View 2 Replies
Mar 25, 2010
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.
View 6 Replies
Apr 23, 2010
I created a MultiView with about 10 different views for a data entry program. As the user steps through the process, they key the data requested and conditionally takes them to the next appropriate view and stores the keyed data from a text box in a session variable. At the end of the process, it displays all of the information that was keyed and then using the on_click handler on the confirm button I insert it into a SQL table and provide a confirmation number. After that is complete, the user will click home, which defaults the activeviewindex back to 0 and proceed with keying the next callers information in.
When they click home and start to proceed back through the screens, it has all of the information from the previous session prepopulated in all of the controls. Since I am not really using a form submit, I can't figure out how to reset all the textboxes and session variables after the SQL insert. I tried looping through the controls but I guess they have to be active to clear them and am looking for something simple to perform this operation without manually setting each textbox.text back to "".
View 3 Replies
Mar 28, 2011
I am using ASP.NET 2.0 and C#. I would like to know if the Session variables are Case-sensitive.
Is Session["StudentId"] and Session["StudentID"] considered the same.
Which would be the proper way to access the session details, when in a page someone passes data as Session["StudentId"] and somebody else passes as Session["StudentID"]?
View 6 Replies
Jun 10, 2010
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:
Get_Summary_Last_Completed_Shift()
code in sub:
mySqlDataAdapter.Fill(mySqlDataTable)
Session("mySqlDataTable1") = mySqlDataTable
GridView1.DataSource = mySqlDataTable
GridView1.DataBind()
Code:
Get_Petroleum_Disbursement()
code in sub:
mySqlDataAdapter.Fill(mySqlDataTable)
Session("mySqlDataTable5") = mySqlDataTable
GridView5.DataSource = mySqlDataTable
GridView5.DataBind()
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.
View 2 Replies
Oct 15, 2010
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?
View 2 Replies