Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 


ASP.NET State Management articles and tutorials

Read ASP.NET State Management articles

Sort by:

<< Start < Prev 1 Next > End >>
Page 1 of 1

ASP.NET State Management articles and tutorials

# articles: 3  


Detecting Refresh or Post back in ASP.NET

View(s): 9472

Detecting Refresh or Post back in ASP.NET


The problem
There are situations where we would like to detect if the post back is from a form interaction (i.e. submit or button clicks) or is it by hitting the browser F5 refresh button. 

Many of them will jump saying how about checking 'Ispostback' value. 'IsPostback' will always have the value which was set previously. So for instance if the page was posted back before refresh, then the value will be true and if the page is not posted back before refresh, then the value will be false.

This article will first explain the fundamentals of how to solve the above problem and later this article will go in depth of how the source code looks like.

The fundamental

Description: 12.jpg

  • Step 1 :-We have created a javascript which will generate unique fresh GUID in submit button click. This GUID will be stored in the HttpContext object.
  • Step 2( User presses submit click ) :- If user presses submit button it will call the necessary javascript function to create the new fresh GUID again. 
  • Step 3 :-In 'HttpHandler' or 'HttpModule' the new GUID value is checked with the old GUID value. If the values are not equal then it means this was not called from a submit click and it's a refresh event. Accordingly the HttpContext session value is set.
  • Step 4 :-In the page load we can then check if this was a refresh or post back using the session variables.

3 important parts of the code

There are 3 important part of the code to be understood :-

  • Javascript which generates the unique
(Continued...) View Full Aritlce


  Last updated on Saturday, 21 June 2014
  Author: Mr. Ponna
4/5 stars (8 vote(s))



ASP.NET Caching Basics

View(s): 5053

I will not bore you about "why caching is so great"; it is assumed you already understand, at least in theory, what caching can buy you as an ASP.NET developer.

At a minimum a developer wants to be able to cache some (or possibly all) of the pages in her ASP.NET Application. The simplest way to achieve this is to add the @ OutputCache directive to the top of the .aspx file of each page:

<%@ OutputCache Duration="5" VaryByParam="none" %>

Now, that was easy, wasn't it? But - exactly what does it do? You are specifying how long the page is to be retained in the Cache with the Duration attribute, in seconds. In the above example, this page will be rendered on the first request for it, and stored in Cache. For five seconds, all subsequent requests for this page will be served from the Cache, which is hugely faster than having to go through the entire Page lifecycle, possibly combined with database access, re-render and finally serve the page HTML to the client. After five seconds, the page will again be rendered (and once again, stored in the Cache).

The VaryByParam attribute is used to define parameters that determine which cached copy of a page should be sent to the browser. If your page doesn't change, you can set this to "none".

Caching Pages Based on QueryString items

If the contents of one of your pages can vary based on the value of certain items on the querystring, which is a common technique in ASP.NET, you can populate the VaryByParam attribute with a semicolon-delimited

(Continued...) View Full Aritlce


  Last updated on Friday, 04 October 2013
  Author: Mr. Ponna
5/5 stars (1 vote(s))



What is cookie less session? How it works?

View(s): 44393

When a user visits a Web site for the first time, the site creates a unique ID, known as a Session ID. The Session ID is unique for that current Session, making it possible for the server to keep track of the user's current Session information.

Generally this Session ID will be stored in cookie, for every request, browser will send this cookie back to server and will track the user session and restore correct user session back for that request.

What happens if cookies are not supported? ASP.NET server fails to track the session information. Then cookieless sessions are the best option. If you set the cookieless attribute of the sessionState element to "true" in your web.config, you will notice that sessions still work perfectly.

<sessionState cookieless="true" />

So, how it is tracking session information without cookies? Where is ASP.NET storing the session ID when cookies are not being used? In this case, the session ID is inserted in a particular position within the URL. Imagine you request a page like http://yourserver/folder/default.aspx, the slash immediately preceding the resource name is expanded to include parentheses with the session ID stuffed inside, as below.

http://yourserver/folder/(session ID here)/default.aspx

The session ID is embedded in the URL and there's no need to persist it anywhere.

Below are possible options to set cookieless session state.

  1. UseCookies - Cookies are always used, even if the browser or device doesn’t support cookies or
(Continued...) View Full Aritlce


  Last updated on Saturday, 14 September 2013
  Author: Mr. Ponna
3/5 stars (31 vote(s))

<< Start < Prev 1 Next > End >>
Page 1 of 1
Register Login Ask Us Write to Us Help