Here you can download file …


New Microsoft Word Document

mnvs akola


State Management In ASP.NET

State Management in ASP.NET

State management means to preserve state of a control, web page, object/data, and user in the application explicitly because all ASP.NET web applications are stateless, i.e., by default, for each page posted to the server, the state of controls is lost. Nowadays all web apps demand a high level of state management from control to application level.

The following types of State Management Available in ASP.NET

                                                    State Management

Client Side                                                                                Server Side

Hidden Field                                                                                         Session

Cookies                                                                                                 Application


Query String

Control State

Levels of state management 

>> Control level: In ASP.NET, by default controls provide state management automatically.

>> Variable or object level: In ASP.NET, member variables at page level are stateless and thus we need to maintain state explicitly.

>> Single or multiple page level: State management at single as well as multiple page level i.e., managing state between page requests.

>> User level: State should be preserved as long as a user is running the application.

>> Application level: State available for complete application irrespective of the user, i.e., should be available to all users.

>> Application to application level: State management between or among two or more applications.

There are Following Types of State Management At Client Side Lets discuss One by one

Hidden Field:

Hidden field is a control provided by ASP.NET which is used to store small amounts of data on the client. It store one value for the variable and it is a preferable way when a variable’s value is changed frequently. Hidden field control is not rendered to the client (browser) and it is invisible on the browser. A hidden field travels with every request like a standard control’s value.

How will we implement:

write this code in Page source file

 <asp:HiddenFieldID=”HField1″ value=1runat=”server”/>

write this code in Page_Load event

protectedvoid Page_Load(object sender, EventArgs e)

   if (HField1.Value != null)
    int val= Convert.ToInt32(HField1.Value) + 1;
    HField1.Value = val.ToString();
    Label1.Text = val.ToString();
Cookies Session

1. Cookies can store only “string” datatype
1. Session can store any type of data because the
value is of datatype of “object”
2. They are stored at Client side  2. These are stored at Server side
3. Cookie is non-secure since stored in text format at
client side
3. Session are secure because it is stored in binary
format/encrypted form and it gets decrypted at server
4. Cookies may or may not be individual for every
4. Session is independent for every client i.e
individual for every client
5. Due to cookies network traffic will increase.Size
of cookie is limited to 40 and number of cookies to be used
is restricted to 20.
5. There is no limitation on size or number of
sessions to be used in an application
6. Only in few situations we can use cookies because
of no security
6. For all conditions/situations we can use sessions
7. We can disable cookies
7. we cannot disable the sessions. Sessions can be used
without cookies also(by disabling cookies)
8. Since the value is string there is no security
8. The disadvantage of session is that it is a
burden/overhead on server
9. We have persistent and non-persistent cookies 9. Sessions are called as Non-Persistent cookies
because its life time can be set manually

Asp.NET Basics


Create first Web Site Using ASP.NET

Steps to follow:

1. click Start—>open Microsoft Visual Studio 2010/2012

2. click on Visual Studio 2010/2012

3. click on file menu—>new—->website


4. choose language as C#

5. Take Asp.net Empty Web Site Template


6. click okay.

Click on solution Explorer which is present at right side of the window

if it is not there then

go to view menu click —->Solution Explorer.

It Will appear at right side of window


Right Click On the solution add—>new item—>choose any web form template and add here we go ….

In source code



<h1>This is my first Website</h1>



you just created your first website

now click on run(play green button) or press F5.



Asp.net Basics



Asp.net is not a programming language. Asp.net is a server-side or web-technology which is used to develop intractive websites and Dynamic websites.

Asp.net code will be written in followings languages:

C#.NET(c sharp)



Now here We ll discuss About What are the Requirement for run Asp.net Application:

1.Operating System – Windows

2.Web Server- IIS

3.Framework- .NET

4.Editor Tools- Visual Studio.NET/Visual Web Developer

5.Database- SQL Server/Oracle etc.

Now Understand One By One You All know About Operating System then Lets Discuss about Web Server

Web Server-

Web Server is a Software Components which takes the user Request And Processes on it And gives Reply back to the client as a Result.

Note:-Without Web Server it is Impossible to Run website which is developed in any Technology.

e.g IIS is Developed By Microsoft.

e.g Apache Tomcat -Non Microsoft.

Hear now check Whether IIS is Installed or Not in your System. Follow steps

1.click on Start Button

2.Click on Run

3.and type “Inetmgr” into it

4.press ok.

This will open IIS Console if this Console is opened IIS is Available Otherwise You need to install.

If not install now we will discuss How to install IIS :

1. Click on Start Button

2. Click on Settings

3. Click on Control Panel

4. Double click on Add/Remove Programs

5. Click on Add/Remove

(window wizard will be open)

6. Activate the Option IIS

7. Click On Next.

8. System will Prompt Insert Operating System CD

9. Then Insert CD And Click On OK.

10. Wait Until Installation Completes

11. Click On finish Button.

Note : After IIS Installation, Then Install VS.NET or Framework.

>>>>How to configure Asp.net With IIS

After Completion of VS.NET

follow Followings steps :

1. Click on start Button

2. Click on Programs.

3. Click on Visual Studio (Which We Install Just Now)

4. Click on Visual Studio Tools

5. Click on Visual Studio Command Prompt

6. Now type “Aspnet_RegIis”.

Note: This will stop IIS and Restarts, Wait Until IIS Restrated.

>>>>To Creating Website Using Visual Studio.NET

1. Start Visual Stidio In Administrator Mode

(right click on vs.net and click on run as administrator)

2. go to File –>Click new Website

–>language as C#(vb.net is Default)

–>select empty website Template

–>set location(directory to Save)

e.g:->c:/demos or http://localhost/

–>choose framwork as what you want I prefer 4.5(options 4.0/3.5/3.0/2.0)

–>click ok

–>select project (solution explorer)

–>right clcikon it add –>new item–>add html page(add some code in that page)

–>Run your website by clicking play button or Pressing F5

Note:Refer my HTML Notes for Making HTML pages.

Asp.net Having Following types of File

A project contains the following content files:

  • Page file (.aspx)

    –>Design(controls physical Appearance of the Page And Controls).

    –>Source(controls respective code for desigining).

  • User control (.ascx)

  • Web service (.asmx)

  • Master page (.master)

  • Site map (.sitemap)

  • Website configuration file (.config)

Asp.net Mainly contians the Two types of Coding Techniques:

1.Inline coding

In this designing code and Programming code part Will be implemented using single file i.e. [.aspx].


>Programmer needs to wait until designer completes designing so programmers time will be wasted.

>debugging becomes difficult to the programmers.

>security won’t maintained for the programmer from designer.

2.Outline Coding/Code Behind Techniques

To overcome the inline coding perspectives the outline/code behind Is used. It means simple, our designing part will be in different file(.aspx) and programming code will be in different file(.aspx.cs).


>Programmer time won’t be wasted.

>Debugging is easy to Programmers.

>security maintained from designers.

asp.net coding Techniques

Digital clock



Digital Clock Dispalying on web page….



<script type=”text/javascript”>
function fs(){
var d=new Date();
var hh=d.getHours();
var mm=d.getMinutes();
var ss=d.getSeconds();


setTimeout(“fs()”, 1000);

<body bgcolor=”white” onload=”fs()”>
<div align=”center”>
<span id=”countdown” style=”background-color:blue;font-size:380px;”></span></div>

JavaScript Basics


What is JavaScript ?
JavaScript is:
JavaScript is a lightweight, interpreted programming language
Designed for creating network-centric applications
C omplementary to and integrated with Java
C omplementary to and integrated with HTML
Open and cross-platform
JavaScript Syntax:
A JavaScript consists of JavaScript statements that are placed within the <script>… </script>
HTML tags in a web page.
You can place the <script> tag containing your JavaScript anywhere within you web page but it is
preferred way to keep it within the <head> tags.
The <script> tag alert the browser program to begin interpreting all the text between these tags
as a script. So simple syntax of your JavaScript will be as follows
<script ...>
JavaScript code

The script tag takes two important attributes:
language: This attribute specifies what scripting language you are using. Typically, its
value will be javascript. Although recent versions of HTML (and XHTML, its successor)
have phased out the use of this attribute.
type: This attribute is what is now recommended to indicate the scripting language in use
and its value should be set to “text/javascript”.
So your JavaScript segment will look like:
<script language="javascript" type="text/javascript">
JavaScript code

The First Program For JavaScript is Looks Like Follows

<script language="javascript" type="text/javascript">
document.write("Hello World!")

Above code will display following result:
Hello World!

Coming soon…………………………….!

HTML Basics




HTML Stands For Hyper Text Markup Language, Here this language is very useful in Web now here we ll discuss about the some Important tags in HTML,Which little more useful to understand the Basic idea behind the Technology.Html is not case sensitive language

Here it goes…now,


This Tag tells to server this tag should interpreted as HTML. This tag always First Tag of the Web Page .<HTML>is opening Tag  and </HTML> is closing Tag.



<head><title>Title of Page</title></head>




Identifies the “HEAD” section of your HTML page. Internet browsers will probably assume it is there even if the tags are not.

refer above Example


Identifies the title bar text for your page. One and only one tag set should appear in your HTML document. This tag is always
located between the Head tags of your document.

refer above Example


These tags Identify the Body section of your page. Most of the content that anyone sees on your page will be situated
between the opening and closing Body tags. The browser will always assume these tags exist even if you don’t include them
in your HTML document. However, you should use them to take advantage of the attributes listed below.
background=” “, bgcolor=” ” id=”” And So on.


<head><title>Title of Page</title></head>

<body bgcolor=”black”>

//Some Content Here……




This tag will create a single line break that returns text to the next line. This tag can be used anywhere within the Body of your HTML code.


<center> </center>
Text  between these tags will be centered on your HTML page.

<center>This text is centered.</center>


This tag will create the Table in webpages This table tag have sub tags like,

<th></th> is used to display Table headings.

<tr></tr> is used to display Table Row

<td></td> is used to display Table Data









<a> </a>
You can use the Anchor tag to link to other documents in your Web site or to other pages on the Internet. Normally you include the href=attribute to specify the location to which to you want to link. The text that appears between the opening and closing Anchor tags serves as the underlined hyperlink on your web page. You can also use these tags for files that you  want visitors to download. For example, if you link to a MS Word Document, a zip file, or a PDF file, the browser will ask  the visitor if they want to download and save the file.
href=”URL of the page “

<a href=”Some Page Url here….!”>Text</a>

<img> No closing tag needed.
The Image tag serves as a link to an external image. The image itself will replace this tag when a visitor views your HTML page. The
src=attribute is used to name and specify the location of the image file. The remaining attributes are measured in numbers of pixels and are specified using numbers. Experiment with the different attributes and see what happens.

src=” “, border=” “, height=” “, width=” “

<img src=”image URL(Path)of file” height=”200″ width=”200″/>

<p> </p>
Paragraph tags are used to combine lines of text into paragraphs. Paragraphs will automatically be single-spaced without using the Break tag. An empty line will always appear following the closing Paragraph tag.
align=”center”, “left”, “right”

<p align=”right”>Team work</p>

<ol> </ol>
Ordered list tags can be used to make a numbered list on your Web page. The opening and closing tags are used to specify
the beginning and end of the list. List items are surrounded by list item tags.

<ul> </ul>
Unordered list tags can be used to make a bullet list (not numbered) on your Web page. The opening and closing tags are used to specific the beginning and end of the list. As with the Ordered list, list items are surrounded by List Item tags.

<li> </li>
List item tags are used to specify list items in both Ordered lists and Unordered lists.

<b> </b>
Text  between these tags will be displayed in bold font on your HTML page.

Horizontal rules

Horizontal lines can be added by doing the following code:
You can also change the width of the line as well as align them to the left or right, as can be seen here:
<HR ALIGN=”left” WIDTH=”50%”>
Please note that you can have the width in pixels instead of percentages as well. You can also change the height in
pixels by doing the following:
<HR SIZE=”5″>