All about viewstate:
Adding item to the viewstate:
Page_load(-)
{
if(page.ispostback==false)
{
ViewState.Add(“SomeValue”,”HelloWorld”);
}
}
retrieving viewstate item value:
protected void button_click(-)
{
resultLabel.Text=ViewState[“SomeValue”].ToString;
}
All about session:
You can't really use a cookie to store a shopping cart. A cookie is just too small and too simple. To enable you to work around the limitations of cookies, the ASP.NET Framework supports a feature called Session state. Like cookies, items stored in Session state are scoped to a particular user. You can use Session state to store user preferences or other user-specific data across multiple page requests.
You add items to Session state by using the Session object.
Adding an item in session state in global.asax
Void session_start(object sender,eventargs e)
{
Session.Add(“SomeValue”,”Session.SessionID”);
}
Retrieving session state item when postback:
Protected button_click (object sender,eventargs e)
{
resultLabel.Text=Session[“SomeValue”].ToString;
}
Wednesday, May 23, 2007
Sunday, May 20, 2007
My favorite asp.net books
I have read quite a few books this year.Some i really liked.One particular book i loke to discuss is from the wrox press.The book is titled "asp.net 2.0 website programming" by Marco Bellinaso..I have been waiting for this kind of book bigtime...This book gives you comprehensive way to build a website from scratch and adds features like login,articles management and ecommerce portal...As the chapter progresses he introduces new concepts of asp.net...Its been a month since i got this book on the net and printed and read it.Anyone interested can get it on this bittorrent website http://www.ebookshare.net....Another companion book while reading this book is the "Asp.net Unleashed" by Stephen Walter by Sams press...you can find it on the same website....I have slew of books to read about dotnet and asp.net but i find these books standing out among others...Happy reading.
Response.Redirect Versus Server.Transfer
There appears to be two different ways of programmatically switching to another page: Response.Redirect and Server.Transfer. The Response.Redirect method sends a message to the requesting client to request a new page. This requires a round trip between the
browser and the server, but allows the user to see the new URL in the browser address
bar. Server.Transfer is a quicker approach in that ASP.NET simply loads the specified
page without the round trip. As a result, the browser’s address bar is not updated.
This can be particularly useful for pipeline style processes such as a checkout system in which the user does not need to see the URLs of pages within the pipeline.
browser and the server, but allows the user to see the new URL in the browser address
bar. Server.Transfer is a quicker approach in that ASP.NET simply loads the specified
page without the round trip. As a result, the browser’s address bar is not updated.
This can be particularly useful for pipeline style processes such as a checkout system in which the user does not need to see the URLs of pages within the pipeline.
ASP.NET file extensions
*aspx-ASPX is a text file format used to create Webform pages; in programming jargon, the ASPX file typically contains static HTML or XHTML markup, as well as markup defining Web Controls and Web User Controls where the developer places all the required static and dynamic content for the web page.
* asax - Global.asax, used for application-level logic and event handling[1]
* ascx - Web UserControls: custom controls to be placed onto web pages.
* ashx - custom HTTP handlers
* asmx - web service pages.
* axd - when enabled in web.config requesting trace.axd outputs application-level tracing. Also used for the special webresource axd handler which allows control/component developers to package a component/control complete with images, script, css etc. for deployment in a single file (an 'assembly')
* browser - browser capabilities files stored in XML format; introduced in version 3.0. ASP.NET 2 includes many of these by default, to support common web browsers. These specify which browsers have which capabilities, so that ASP.NET 2 can automatically customize and optimize its output accordingly. Special .browser files are available for free download to handle, for instance, the W3C Validator, so that it properly shows standards-compliant pages as being standards-compliant. Replaces the harder-to-use BrowserCaps section that was in machine.config and could be overridden in web.config in ASP.NET 1.x.
* config - web.config is the only file in a specific Web application to use this extension by default (machine.config similarly affects the entire Web server and all applications on it), however ASP.NET provides facilities to create and consume other config files. These are stored in XML format, so as to allow configuration changes to be made with simplicity.
* cs/vb - In ASP.NET 2 any cs/vb files placed inside the App_Code folder are dynamically compiled and available to the whole application.
* master - Master Pages; introduced in version 2.0
* sitemap - sitemap configuration files
* skin - theme skin files.
* resx - resource files for internationalization and localization. Resource files can be global (for e.g. messages) or "local" which means specific for a single aspx or ascx file.
* asax - Global.asax, used for application-level logic and event handling[1]
* ascx - Web UserControls: custom controls to be placed onto web pages.
* ashx - custom HTTP handlers
* asmx - web service pages.
* axd - when enabled in web.config requesting trace.axd outputs application-level tracing. Also used for the special webresource axd handler which allows control/component developers to package a component/control complete with images, script, css etc. for deployment in a single file (an 'assembly')
* browser - browser capabilities files stored in XML format; introduced in version 3.0. ASP.NET 2 includes many of these by default, to support common web browsers. These specify which browsers have which capabilities, so that ASP.NET 2 can automatically customize and optimize its output accordingly. Special .browser files are available for free download to handle, for instance, the W3C Validator, so that it properly shows standards-compliant pages as being standards-compliant. Replaces the harder-to-use BrowserCaps section that was in machine.config and could be overridden in web.config in ASP.NET 1.x.
* config - web.config is the only file in a specific Web application to use this extension by default (machine.config similarly affects the entire Web server and all applications on it), however ASP.NET provides facilities to create and consume other config files. These are stored in XML format, so as to allow configuration changes to be made with simplicity.
* cs/vb - In ASP.NET 2 any cs/vb files placed inside the App_Code folder are dynamically compiled and available to the whole application.
* master - Master Pages; introduced in version 2.0
* sitemap - sitemap configuration files
* skin - theme skin files.
* resx - resource files for internationalization and localization. Resource files can be global (for e.g. messages) or "local" which means specific for a single aspx or ascx file.
ASP.NET
ASP.NET is a web application framework marketed by Microsoft. Programmers can use it to build dynamic web sites, web applications and XML web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology.
ASP.NET is built on the Common Language Runtime, meaning programmers can write ASP.NET code using any Microsoft .NET language.
ASP.NET is built on the Common Language Runtime, meaning programmers can write ASP.NET code using any Microsoft .NET language.
global.asax magic
Well have come to accept the fact that this
is microsoft centric world.
I am walking through the examples in
asp.net 1.1 with vb.net (wrox)
i created a basic C# project and the
the following files created were.
assemble.cs
global.asax
web.config
WebForm1.aspx
I get WebForm1.aspx this is the server side page.
but i really need to refreshe what i know
about what the asax does
here is what microsoft says
The Global.asax file, also known as
the ASP.NET application file, is an
optional file that contains code for
responding to application-level events
raised by ASP.NET or by HTTP modules.
The Global.asax file resides in the
root directory of an ASP.NET application.
At run time, Global.asax is parsed and
compiled into a dynamically generated
.NET Framework class derived from the
HttpApplication base class.
The Global.asax file itself is
configured so that any direct URL
request for it is automatically rejected;
external users cannot download or
view the code in it.
is microsoft centric world.
I am walking through the examples in
asp.net 1.1 with vb.net (wrox)
i created a basic C# project and the
the following files created were.
assemble.cs
global.asax
web.config
WebForm1.aspx
I get WebForm1.aspx this is the server side page.
but i really need to refreshe what i know
about what the asax does
here is what microsoft says
The Global.asax file, also known as
the ASP.NET application file, is an
optional file that contains code for
responding to application-level events
raised by ASP.NET or by HTTP modules.
The Global.asax file resides in the
root directory of an ASP.NET application.
At run time, Global.asax is parsed and
compiled into a dynamically generated
.NET Framework class derived from the
HttpApplication base class.
The Global.asax file itself is
configured so that any direct URL
request for it is automatically rejected;
external users cannot download or
view the code in it.
Subscribe to:
Posts (Atom)