State Management :: Got .net Web Application And Testing The Pages?
Nov 28, 2010
Ive got an ASP.net web application and was testing the pages.At the moment I store a variable in the
System.Web.HttpContext.Current.Session[
say the user is authenticated when they have been verified on login.So if the login is successful the authenticated is set to true.This is checked on every page load to make sure they have logged in.What I did was to log in and then the Main Menu page is displayed.I copied the address of this, set the page to goggle's page then pasted the address back into the address bar and the page loaded back up.How can I stop this from happening?Should have some mechanisim to prevent this?If so how.
View 2 Replies
Similar Messages:
Aug 11, 2010
We have used Session heavily in our application, we have created core classes (which have many properties) and store objects of core class in the session.
1) What could be the best solution for reflector activity?
2) What could be the best way to manage session in an application which has 100 pages?
View 9 Replies
Aug 22, 2010
I have written an ASP.Net website and tried to implement the common poor mans online user count. The problem I am having is the following.
On App_Start I create a variable and assign it the value of 0;
Then increase the number on session_start and decrement on session_end.
On my local IIS it works perfectly from IE8 and Opera. The value increments correctly. As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8. This does not happen when testing with Opera.
View 12 Replies
Aug 9, 2010
In my Application_BeginRequest I have code that gets query string value ?c=FR or ?c=US and store it in cookies.Based on query string value I have either US or FR,locale is selected from locale table.If ?c=FR then locale will be fr-FR and if it is US then locale will be en-US.My code is below.
void Application_BeginRequest(object sender, EventArgs e)
{
LocalizationInfo loc = GetLocalizationInfo();
if (Request.Cookies["Localization"] == null)
Response.Cookies.Add(new HttpCookie("Localization"));
Response.Cookies["Localization"]["Country"] = loc.Country;
CultureInfo objCI = new CultureInfo(loc.Locale);
Thread.CurrentThread.CurrentCulture = objCI;
Thread.CurrentThread.CurrentUICulture = objCI;
}
public static LocalizationInfo GetLocalizationInfo()
{
string countryCode = "";
string sLocale = "";
if (HttpContext.Current.Response.Cookies["Localization"]["Country"] != null)
countryCode = HttpContext.Current.Response.Cookies["Localization"]["Country"];
if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["c"]))
countryCode = HttpContext.Current.Request.QueryString["c"];
if (countryCode == "")
countryCode = "US";
sLocale = HertzRent2Buy.DataProvider.ListData.GetLocale(countryCode);
LocalizationInfo ret = new LocalizationInfo();
ret.Country = countryCode;
ret.Locale = sLocale;
return ret;
}
public struct LocalizationInfo
{
public string Country;
public string Locale;
}
Now when I run the project and in query string I set [URL] then for the very first page(home page itself) it shows me French translation,but on subsequent page,that query string parameter ?c=FR is lost and hence it shows be English translation not French translation since it does not pickup French resx file.If I manually append ?c=FR in subsequent page then it shows the French translation.Is there is way how I can make that query stringparameter available in all pages.Structure is there to hold Country and locale variables. In all pages I am calling GetLocalizationInfo() method as follow
LocalizationInfo info = some.DataProvider.Globalization.GetLocalizationInfo();
And I create instance info to pass locale and country as parameter. GetProductDetails(id,info.Country,info.locale). why my query string parameters get lost on subsequent pages.
View 1 Replies
Feb 25, 2011
i have places a treeview in the master page, if i click on certain node it will navigate to some x.aspx page.here the proble is treview nodes all are collasped.
View 2 Replies
Nov 1, 2010
All we have a global ships position tracking website which runs smoothly until IIS application pool recycles.When there is workerprocess recycling looks like session state expires as a result i loose all session data and when customer clicks refresh button he is redirected to login page.
In web.config Session state mode is set to InProc so i changed it to State Server but to my luck i have MAP object which is not serialiazable which is causing the maps from not appearing on the website.I tried adding serializable attribute to the object class but still not succesfull.Our website is accessed by our customers whose count is more than 1000.
Changing the session state mode from InProc to StateServer can really slow down the response time so
Is it good to go further fix the serailizable issues and move to state server?.
Is there any way I can retain my session data when application pool recyles?..
Stopping Application pool from recycling may not be a good idea considering health factor of web server.
View 8 Replies
May 26, 2010
I am getting this error while executing my Asp.Net application.i am not able to execute application using Visual Studio Interface and when i am trying to execute application from Local IIS. its executing well but when i am trying to click any button for searching etc it is giving this error. The state information is invalid for this page and might be corrupted. The detailed information is
[Code]....
[FormatException: Invalid character in a Base-64 string.] System.Convert.FromBase64String(String s) +0 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 System.Web.UI.HiddenFieldPageStatePersister.Load() +113[ViewStateException: Invalid viewstate. Client IP: 127.0.0.1Port: 1307User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5ViewState: /wEPDwULLTIwOTUyMjAzMTgPZBYCZg9kFgICAw9kFgICCw9kFgICAQ9kFhgCAg8QDxYCHgtfIURhdGFCb3VuZGdkDxYFAgECAgIDAgQCBRYFEAUHQ2VudHJhbAUCODBnEAUITm9ydGhlcm4FAjgxZxAFB0Vhc3Rlcm4FAjgyZxAFCFNvdXRoZXJuBQI4M2cQBQdXZXN0ZXJuBQI4NGdkZAIJD2QWAmYPZBYKAgEPEA8WAh8AZ2QPFgUCAQICAgMCBAIFFgUQBQdDZW50cmFsBQI4MGcQBQdFYXN0ZXJuBQI4MmcQBQhOb3J0aGVybgUCODFnEAUIU291dGhlcm4FAjgzZxAFB1dlc3Rlcm4FAjg0ZxYBZmQCBw8QDxYCHwBnZGQWAWZkAgkPD2QPEBYBZhYBFgIeDlBhcmFtZXRlclZhbHVlBQItMRYBZmRkAgsPEA8WAh8AZ2RkFgFmZAINDw9kDxAWAWYWARYCHwEFAi0xFgFmZGQCCg9kFghmDw8WAh4JTWF4TGVuZ3RoZmRkAggPDxYEHgxNYXhpbXVtVmFsdWUFCTUvMjYvMjAxMB4MTWluaW11bVZhbHVlBQk1LzI2LzE5MTBkZAIMDxYQHhlDdWx0dXJlRGVjaW1hbFBsYWNlaG9sZGVyBQEuHgdDdWx0dXJlBQVlbi1VUx4bQ3VsdHVyZVRob3VzYW5kc1BsYWNlaG9sZGVyBQEsHg5DdWx0dXJlRGF0ZUZNVAUDTURZHhZDdWx0dXJlQU1QTVBsYWNlaG9sZGVyBQVBTTtQTR4WQ3VsdHVyZVRpbWVQbGFjZWhvbGRlcgUBOh4WQ3VsdHVyZU...][HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 System.Web.UI.HiddenFieldPageStatePersister.Load() +217 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 System.Web.UI.Page.LoadAllState() +43 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 System.Web.UI.Page.ProcessRequest() +80 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +49 ASP.pages__cmtickets_cmtickets_reports_cmtickets_search_aspx.ProcessRequest(HttpContext context) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesapp_mobily_alexmare1eddc658e6f2ba5App_Web_b9acfmsy.14.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
View 3 Replies
Feb 23, 2011
I am very new to asp.net. I developed one application. In that I have two pages. First page contains Application.Get() in page load event, here I read this Application variable, initially it returns NULL. If it is NULL, I make some buttons invisible. Then I jump to second page, in that page contains Application.Set(). Again I jump from second page to first page, this time Application.Get() is not NULL, I make some buttons visible.This is ok, if I execute the program in .net software.
But, when I publish this same program to web server like IIS, it is not working properly. After publishing very first time the first page returns NULL after that it doesnt return NULL even I closed the browser. I dont know why. In program, I used 2.0 framework. IIS also has 2.0 framework. Please clear this issue.
View 6 Replies
Nov 3, 2010
global.asax:-I have defined a struct (my_struct)-I add a List of structs (List<my_struct>) to Application["MyList"] In default.aspx:-I have defined the exact struct (my_struct) and want to cast the Application["MyList"] object to the List of structs.
example: x = (List<my_struct>)Application["MyList"];
I receive this error "Unable to cast object of type 'System.Collections.Generic.List`1ASP.global_asax+my_struct]' to type 'System.Collections.Generic.List`1[_Default+my_struct]'
View 1 Replies
Oct 2, 2010
User Interface: 2 Labels; 1 Buttons
Requirements: Create a Web Page in ASPx that will do the following:
1)One label will provide a count of how many times Button 1 has been clicked in the current session.
2)One label will provide a count of how many times Button 1 has been clicked by all users of the application. The Application Code for the Button should start at 100 (set this in the Global.asax file). this is what i have so far but i cant seem to get the application state to work properly.
aspx.vb
Partial Class _Default
Inherits System.Web.UI.Page
Dim clickcount As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("ClickCount") Is Nothing Then
clickcount = 0
Else
clickcount = CInt(Session("ClickCount"))
End If
If Not IsPostBack Then
If Request.Cookies("UserName") IsNot Nothing Then
Label1.Text = "Welcome Back " & Request.Cookies("UserName").Value & "."
End If
End If
Dim clickCounta As Integer = CInt(Application("ClickCount"))
End Sub
Protected Sub PostBackSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.Click
clickcount += 1
lblClkCnt.Text = "Current Click Count is " & clickcount
Application.Lock()
Dim clickCounta As Integer = CInt(Application("ClickCount"))
clickCounta += 1
Application("ClickCount") = clickCounta
Application.UnLock()
AppClick.Text = clickCounta
Dim nameCookie As New HttpCookie("UserName", _
TextBox1.Text)
nameCookie.Expires = Now.AddYears(1)
Response.Cookies.Add(nameCookie)
End Sub
Protected Sub PostBackSession_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.PreRender
Session("ClickCount") = clickcount
Application("ClickCount") = clickcount
End Sub
End Class
global.asax
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(Application("ClickCount"))
Application.Add("ClickCount", 0)
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(HttpContext.Current.Application("ClickCount"))
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
View 3 Replies
Aug 8, 2010
i have a widget(say some widget to get two cities) on my home page. also a submit button. when the user clicks the submit button, the value of cities given in the widget is passed to the next page and displayed in two text boxes respectively. sample code given below.
http://home.aspx/SessionHandler.aspx?pub=/english&pageurl=/search.aspx§ion=search&seldcity1=berlin&selacity1=dublin&selddate1=15-Dec-10&seladate1=29-Dec-10&resultby=1&bsp=Timetables&j=f&showpage=true&TID=SB&CID=
now i need to modify this page so that the search.aspx page should be dispalyed on some condition. smaple url:
http://home.aspx/SessionHandler.aspx?pub=/english&pageurl=/search.aspx§ion=search&seldcity1=berlin&selacity1=dublin&selddate1=15-Dec-10&seladate1=29-Dec-10&resultby=1&bsp=Timetables&j=f&showpage=true&TID=SB&CID=&showsearch=true
how do i acheive this? also, where should i modify the code. in the target page(search.aspx) rite? also which section of that page? some key words pls??
View 3 Replies
Aug 20, 2010
how to pass the value from one page to another page in asp.net with out Using State Management Concepts?
Like 1. cookies 2.Sessiion 3. QueryStrings.With out using the above should pass the values..
View 4 Replies
Mar 4, 2011
I am using a treeview in my master page and every node having link to its container page.That means click on any child node of treeview its redirect to another page by taking some value.
Now every time I click on nodes of treeview, its get collaps when child page loaded...
Now regaring maintain state of treeview across my web application...
View 13 Replies
Feb 7, 2011
I am using Visual C#. ould smbd tell me how can i take the data inserted from the user (1. in a textbox 2. in a dropdownList and 3. in a radiobutoonList) and use (or display) that data in another .aspx page ?
View 2 Replies
Nov 12, 2010
I had created one array who's value I want to pass to different webpages in asp.net,
I am looking for session variable ,,,, Is this correct way ,,,, and hw to insert value in array and fetch from it using session variable
View 5 Replies
Jul 30, 2010
in one ascx page i'm using gridview.from that i'm selecting a cell value as follows
foreach (GridViewRow gvr in grdOrganization.Rows)
View 2 Replies
Oct 8, 2010
I have to split a long form into two pages. In the first page, I have a button "Next Page" to second page and in second page, a button "Previous page" to go to first page. How do I keep the form data when click "next page" and "previous page"?
I am using session variables to pass the form data. I have the server control Enableviewstat as true, but it still doesn't work. What else should I do? My code as below:
[Code]....
View 8 Replies
Dec 10, 2010
I am using the Session ID Manager. Now the session count is 0 between the access to pages, so I cannot access the Session variables. How do I save the value of Session variables.
View 3 Replies
Jul 12, 2010
How can I retain the value of variables that I fill from CodeBehind throughout the session? (C#). For example, I do a LINQ query from the log in "on-Click" button event. The query produces a bunch of data about the user that I want to access throughout the session on additional ASP pages. I know that I can pass a large query string but I suspect that there is a better way. Here's a specific...
from the db function I product: COS=2 (class of service). Throughout the session, I test for COS and display appropriate pages. Assume that the LINQ query is accomplished in the CodeBehind attached to the "loginButton" within the "login.aspx" page.
View 3 Replies
Nov 23, 2010
I am using Session ID Manager in all the pages of the website, but I am losing session variables in between the pages. what should I do to save the values of session variables.
Anoop
View 5 Replies
Sep 2, 2010
I'm creating a website where I want people not to be able to create link to certain pages.The site work like this: The user do a serch for a document and click the link to view it, then he can view the document. If the user somehow adds the URL to favorites he should not be able to view the document when he at some time later tries to view the document. In addition if the user sends the URL to other people they should not be able to view the document.
View 6 Replies
Feb 13, 2011
I have created a object in ASP.net C# that is a collection (arraylist) of Arrest Warrant objects. How do I make that object available to multiple pages?
View 6 Replies
Sep 22, 2010
I have a question regarding disabling viewstate.
I know how to do this in the page, however if I disable in a master page will all child pages and controls be disabled through inheritance?
View 4 Replies
Apr 13, 2010
How to get that how many pages accesses by a user in a website.
Actually, rather then putting code in each page I want some generalized method/technique that if user Logged to a website and during his Login period what was his activity and which page(s) he accesed.
Note:
1. My website pages are under MasterPage.
2. MasterPage has a MasterMenu.
3. For singlePage activity I used Page.GetType.Name
View 2 Replies
Aug 27, 2010
I have set the output cache for 5 pages(5 minutes)
I want to clear all these pages from cache on some nutton click
View 2 Replies