<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2253622342005515043</id><updated>2012-01-17T10:38:49.213-08:00</updated><category term='AJAX'/><category term='Cookies Stored'/><category term='Cookies'/><title type='text'>Dot Net World</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-7738177512373554219</id><published>2012-01-17T09:59:00.000-08:00</published><updated>2012-01-17T09:59:12.257-08:00</updated><title type='text'>Populating the Menu using the Database</title><content type='html'>&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Suppose you have developed web application with multiple pages and want to give access of pages through web application then you will like to store selected pages and options into database&amp;nbsp;&amp;nbsp;which you want to populate the &lt;code&gt;Menu&lt;/code&gt;.&amp;nbsp; The code below shows how you can use database as a data source:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Private Sub populateMenu()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim ds As DataSet&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;ds = GetDataSetForMenu()&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim mmenu As New Menu&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.Font.Name = "Arial"&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.Font.Size = 11&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.Height = 25&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.Orientation = Orientation.Horizontal&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.BackColor = Drawing.Color.DarkBlue&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.ForeColor = Drawing.Color.LightBlue&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicVerticalOffset = 8&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicMenuStyle.BackColor = Drawing.Color.DarkBlue&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicMenuStyle.ForeColor = Drawing.Color.White&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicMenuStyle.HorizontalPadding = 5&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicHoverStyle.BackColor = Drawing.Color.Blue&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicHoverStyle.ForeColor = Drawing.Color.LightSteelBlue&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicHoverStyle.Height = 20&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.DynamicMenuItemStyle.ItemSpacing = 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;For Each parentItem As DataRow In ds.Tables("mdesc").Rows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; Dim categoryItem As New MenuItem(DirectCast(parentItem("modulecat"), String))&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; mmenu.Items.Add(categoryItem)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; For Each childItem As DataRow In parentItem.GetChildRows("Children")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim childrenItem As New MenuItem(DirectCast(childItem("moduledesc"), String))&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim childrenNavigateItem As New MenuItem(DirectCast(childItem("modulefilename"), String))&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; categoryItem.ChildItems.Add(childrenItem)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; childrenItem.NavigateUrl = childItem("modulefilename").ToString&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp; Next&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Next&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim cItem As New MenuItem(DirectCast("Logout", String))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;mmenu.Items.Add(cItem)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;cItem.NavigateUrl = "logout.aspx"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Panel1.Controls.Add(mmenu)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Panel1.DataBind()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Private Function GetDataSetForMenu() As DataSet&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim myConnection As New SqlConnection(SqlDataSource1.ConnectionString)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim adCat As New SqlDataAdapter("SELECT distinct modulecat, modulecatseq FROM UserProfileQueryNew where muserid='" &amp;amp; useridlbl.Text &amp;amp; "' order by modulecatseq", myConnection)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim adProd As New SqlDataAdapter("SELECT * FROM userprofilequerynew where muserid='" &amp;amp; useridlbl.Text &amp;amp; "'", myConnection)&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Dim ds As New DataSet()&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;adCat.Fill(ds, "mdesc")&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;adProd.Fill(ds, "mchild")&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;ds.Relations.Add("Children", ds.Tables("mdesc").Columns("modulecat"), ds.Tables("mchild").Columns("modulecat"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-size: x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;Return ds&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: #fce5cd; color: purple; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"&gt;End Function&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-7738177512373554219?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/7738177512373554219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2012/01/populating-menu-using-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7738177512373554219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7738177512373554219'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2012/01/populating-menu-using-database.html' title='Populating the Menu using the Database'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-2817075384471700745</id><published>2011-09-26T10:35:00.000-07:00</published><updated>2011-09-26T10:35:38.231-07:00</updated><title type='text'>Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;If you've used the Microsoft ASP.NET AJAX UpdatePanel control, there's a good chance you've hit the "Sys.WebForms.PageRequestManagerParserErrorException" error.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;What's a PageRequestManagerParserErrorException?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered. It does this using a whole bunch of JavaScript on the client and a whole bunch of C# on the server. Asynchronous postbacks are exactly the same as regular postbacks except for one important thing: the rendering. Asynchronous postbacks go through the same life cycles events as regular pages (this is a question I get asked often). Only at the render phase do things get different. We capture the rendering of only the UpdatePanels that we care about and send it down to the client using a special format. In addition, we send out some other pieces of information, such as the page title, hidden form values, the form action URL, and lists of scripts.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;As I mentioned, this is rendered out using a special format that the JavaScript on the client can understand. If you mess with the format by rendering things outside of the render phase of the page, the format will be messed up. Perhaps the most common way to do this is to call Response.Write() during Page's Load event, which is something that page developers often do for debugging purposes.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;The client ends up receiving a blob of data that it can't parse, so it gives up and shows you a PageRequestManagerParserErrorException. Here's an example of what the message contains:&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;---------------------------&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Microsoft Internet Explorer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;---------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Details: Error parsing near 'Hello, World!106upd'.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;---------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;OK &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;--------------------------- &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;If you ask me, this error message is not all that bad. After all, I'm the one that made it :) The details indicate what was being parsed when it decided to give up. You can see the part of the text from my Response.Write(), and immediately after that is part of the special format I keep mentioning.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Why do I keeping getting a PageRequestManagerParserErrorException?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Well, chances are you're doing one of the things mentioned in the error message. Here are the most common reasons and why they don't work:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;1- Calls to Response.Write():&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;By calling Response.Write() directly you are bypassing the normal rendering mechanism of ASP.NET controls. The bits you write are going straight out to the client without further processing (well, mostly...). This means that UpdatePanel can't encode the data in its special format.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;2- Response filters:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Similar to Response.Write(), response filters can change the rendering in such a way that the UpdatePanel won't know.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;3- HttpModules:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Again, the same deal as Response.Write() and response filters.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;4- Server trace is enabled:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;If I were going to implement trace again, I'd do it differently. Trace is effectively written out using Response.Write(), and as such messes up the special format that we use for UpdatePanel.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;5- Calls to Server.Transfer():&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Unfortunately, there's no way to detect that Server.Transfer() was called. This means that UpdatePanel can't do anything intelligent when someone calls Server.Transfer(). The response sent back to the client is the HTML markup from the page to which you transferred. Since its HTML and not the special format, it can't be parsed, and you get the error.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;How do I avoid getting a PageRequestManagerParserErrorException?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;To start with, don't do anything from the preceding list! Here's a matching list of how to avoid a given error (when possible):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;1- Calls to Response.Write():&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Place an &lt;label&gt;or similar control on your page and set its Text property. The added benefit is that your pages will be valid HTML. When using Response.Write() you typically end up with pages that contain invalid markup.&lt;/label&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;2- Response filters:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;The fix might just be to not use the filter. They're not used very often anyway. If possible, filter things at the control level and not at the response level.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;3-&amp;nbsp;HttpModules:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Same as response filters.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;4- Server trace is enabled:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Use some other form of tracing, such as writing to a log file, the Windows event log, or a custom mechanism.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;5- Calls to Server.Transfer():&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;I'm not really sure why people use Server.Transfer() at all. Perhaps it's a legacy thing from Classic ASP. I'd suggest using Response.Redirect() with query string parameters or cross-page posting.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Another way to avoid the parse error is to do a regular postback instead of an asynchronous postback. For example, if you have a button that absolutely must do a Server.Transfer(), make it do regular postbacks. There are a number of ways of doing this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;1- The easiest is to simply place the button outside of any UpdatePanels. Unfortunately the layout of your page might not allow for this.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;2- Add a PostBackTrigger to your UpdatePanel that points at the button. This works great if the button is declared statically through markup on the page.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;3- Call ScriptManager.RegisterPostBackControl() and pass in the button in question. This is the best solution for controls that are added dynamically, such as those inside a repeating template.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;I hope I've answered a lot of questions here and not angered too many of you. We're looking at ways to improve some of these situations in the next version of ASP.NET, but of course there are no guarantees. If you avoid changing the response stream, you're good to go. If you absolutely must change the response stream, simply don't do asynchronous postbacks.&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-2817075384471700745?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/2817075384471700745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2011/09/syswebformspagerequestmanagerparsererro.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2817075384471700745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2817075384471700745'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2011/09/syswebformspagerequestmanagerparsererro.html' title='Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-7780489486367457159</id><published>2009-07-07T00:26:00.000-07:00</published><updated>2009-07-07T01:00:38.353-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>How to remove error "'Sys' is undefined" ASP.NET</title><content type='html'>&lt;span style="font-family:arial;"&gt;When anyone create a normal "ASP.NET Web Site" and not an "ASP.NET Ajax Enabled Web Site" and try to use AJAX Controls this error occurs. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;There are two key tags, that must exist on web.config:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#000000;"&gt;under &amp;lt;assemblies&amp;gt; (possibly you already have this one)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#ff0000;"&gt;&amp;lt;add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;under &amp;lt;httpHandlers&amp;gt; (this is the new one)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#ff0000;"&gt;&amp;lt;add verb="GET" path="ScriptResource.axd" Type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;color:#000000;"&gt;If you use AJAX controls always try to create AJAX Enabled website.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you already created Normal website and wish to use AJAX Controls you can copy following tag alongwith codes from WebConfig file from any AJAX Enabled website.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;Copy assembly under assemblies tag;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;copy httpHandlers tag and code under it; and &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;copy code under httpModules alongwith httpModules tag.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Arial;color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;color:#ff0000;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-7780489486367457159?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/7780489486367457159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/07/how-to-remove-error-sys-is-undefined.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7780489486367457159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7780489486367457159'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/07/how-to-remove-error-sys-is-undefined.html' title='How to remove error &quot;&apos;Sys&apos; is undefined&quot; ASP.NET'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-6314838921316877755</id><published>2009-05-05T11:40:00.000-07:00</published><updated>2009-05-05T11:47:40.442-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cookies Stored'/><title type='text'>Where does cookies are stored in local Hard drive ?</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;This is one of the interesting things to find out the cookies in your local drive. First of all, From "Explorer Folder Option ", Select, show hidden files and folder.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5332412893315404082" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 332px; CURSOR: hand; HEIGHT: 400px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_OP6v5weJHac/SgCJRi3HETI/AAAAAAAAAKI/g3wTI9W7pjo/s400/Cookie8.jpg" border="0" /&gt;  &lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;&lt;span style="font-size:85%;"&gt;Fig 1.2 : Show Hidden files and Folder Settings&lt;/span&gt;&lt;/strong&gt; &lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;br /&gt;Now Browse into document &amp;amp; settings of the current user and open the cookies folder. Now looks the picture.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5332413115248060306" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 129px; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_OP6v5weJHac/SgCJedn-p5I/AAAAAAAAAKQ/waCgVUvRhhs/s400/Cookie9_small.jpg" border="0" /&gt; &lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Fig 1.3 : Reading Cooking info in local System&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-6314838921316877755?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/6314838921316877755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/where-does-cookies-are-stored-in-local.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/6314838921316877755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/6314838921316877755'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/where-does-cookies-are-stored-in-local.html' title='Where does cookies are stored in local Hard drive ?'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_OP6v5weJHac/SgCJRi3HETI/AAAAAAAAAKI/g3wTI9W7pjo/s72-c/Cookie8.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-6470689695041215131</id><published>2009-05-01T08:34:00.000-07:00</published><updated>2009-05-01T08:36:26.133-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cookies'/><title type='text'>How to Read data from cookies ?</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Now , its times to retrieve data from cookies. Ok, before reading cookies, first of all we need to check whether a cookies was found or not. "Its always good practice to check cookie before read it, because is browser is disable cookies.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;a href="http://4.bp.blogspot.com/_OP6v5weJHac/SfsW0q3kGMI/AAAAAAAAAKA/6YPSYVk4AMQ/s1600-h/readcookie.bmp"&gt;&lt;img id="BLOGGER_PHOTO_ID_5330879678039464130" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 453px; CURSOR: hand; HEIGHT: 131px" alt="" src="http://4.bp.blogspot.com/_OP6v5weJHac/SfsW0q3kGMI/AAAAAAAAAKA/6YPSYVk4AMQ/s400/readcookie.bmp" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-6470689695041215131?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/6470689695041215131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-to-read-data-from-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/6470689695041215131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/6470689695041215131'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-to-read-data-from-cookies.html' title='How to Read data from cookies ?'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_OP6v5weJHac/SfsW0q3kGMI/AAAAAAAAAKA/6YPSYVk4AMQ/s72-c/readcookie.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-3012108795134849630</id><published>2009-05-01T08:27:00.000-07:00</published><updated>2009-05-01T08:33:58.495-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cookies'/><title type='text'>How to create cookies ?</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;For working with cookies we need to use namespace System.web&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_OP6v5weJHac/SfsWJD3wi5I/AAAAAAAAAJw/yVO0gohA-Xw/s1600-h/cookies1.bmp"&gt;&lt;img id="BLOGGER_PHOTO_ID_5330878928836922258" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 186px; CURSOR: hand; HEIGHT: 50px" alt="" src="http://2.bp.blogspot.com/_OP6v5weJHac/SfsWJD3wi5I/AAAAAAAAAJw/yVO0gohA-Xw/s400/cookies1.bmp" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Now , have a look, on the code , that how can we create a cookies and add it with web response .3&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;p&gt;&lt;/span&gt;&lt;/p&gt;&lt;a href="http://2.bp.blogspot.com/_OP6v5weJHac/SfsWPvGmsLI/AAAAAAAAAJ4/lubIiSgvf0o/s1600-h/cookies2.bmp"&gt;&lt;img id="BLOGGER_PHOTO_ID_5330879043521130674" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 112px" alt="" src="http://2.bp.blogspot.com/_OP6v5weJHac/SfsWPvGmsLI/AAAAAAAAAJ4/lubIiSgvf0o/s400/cookies2.bmp" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;The cookies which has been created will persist , until browser has been closed. we can persist the cookies. But how? Just after few point I have discussed it.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-3012108795134849630?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/3012108795134849630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-to-create-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/3012108795134849630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/3012108795134849630'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-to-create-cookies.html' title='How to create cookies ?'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_OP6v5weJHac/SfsWJD3wi5I/AAAAAAAAAJw/yVO0gohA-Xw/s72-c/cookies1.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-290253967328007741</id><published>2009-05-01T08:23:00.000-07:00</published><updated>2009-05-01T08:25:37.975-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cookies'/><title type='text'>Advantages &amp; Disadvantages of of Cookies</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Advantages&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Following are main advantages of using cookies in web application:&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;It's very simple to use and implement.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Browser's taking care send data. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;For multiple sites cookies, Browser automatically arranges them.&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;div align="justify"&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;a name="5"&gt;&lt;span style="font-family:arial;color:#000000;"&gt;&lt;strong&gt;Disadvantages&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Main disadvantages of cookies are: &lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:arial;"&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;Its store data in a simple text format. so it's not secure at all. &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;There is a size limit of cookies data ( 4096 bytes / 4KB). &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;Number if cookies also limited. Most Browser provides limits of storing cookies is 20. If new cookies came, it will discard the old one. Some of browser support up to 300. &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;We need to configure browser. It will not work on a high security configuration of browser. [I have explained about this in details.] &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-290253967328007741?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/290253967328007741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/advantages-disadvantages-of-of-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/290253967328007741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/290253967328007741'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/advantages-disadvantages-of-of-cookies.html' title='Advantages &amp; Disadvantages of of Cookies'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-2674187298055205587</id><published>2009-05-01T08:15:00.000-07:00</published><updated>2009-05-01T08:22:06.847-07:00</updated><title type='text'>How Cookies are started  ?</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;When client request to the server, server send the cookies into client . The same cookies can be referred for subsequent request. As for example, if codeproject.com stores session id as a cookies, when any client hits first times on the server, server generates the session id and send it as a cookies to client. [As given in Fig 1.0]&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;img id="BLOGGER_PHOTO_ID_5330875091401646882" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 185px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_OP6v5weJHac/SfsSpsT5IyI/AAAAAAAAAJQ/ANZad8QGMSQ/s400/Cookie1.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;strong&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Fig 1.0 : Initial state of cookie creation&lt;/span&gt;&lt;/strong&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Now for all other subsequent from the same client it uses the session-id from cookies, just like the picture below:&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;img id="BLOGGER_PHOTO_ID_5330875503827224658" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 172px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_OP6v5weJHac/SfsTBst0CFI/AAAAAAAAAJY/7CfJNJl_Bb0/s400/Cookie2.jpg" border="0" /&gt; &lt;p align="center"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;Fig 1.1 : Subsequent request for other pages&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:arial;"&gt;Browser and web server are responsible for exchange cookies information. For different sites, browser keeps cookies differently. If any pages need information from cookies, when that URL is being hit, first its search for local system for cookies information then its moved to server with that information.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-2674187298055205587?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/2674187298055205587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-cookies-are-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2674187298055205587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2674187298055205587'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/how-cookies-are-started.html' title='How Cookies are started  ?'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_OP6v5weJHac/SfsSpsT5IyI/AAAAAAAAAJQ/ANZad8QGMSQ/s72-c/Cookie1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-5968658404109745956</id><published>2009-05-01T08:09:00.000-07:00</published><updated>2009-05-01T08:15:44.387-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cookies'/><title type='text'>What are Cookies ?</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Cookies  are the small files that are created on the client's system or client browser memory (if temporary). Its use for State management that I have already discuss on my view state article.  So we can store small piece of information in a client system and we can use it when we needed. Most interesting thing is that Its works transparently with the user. It can be easily used any where of you web application.  Cookies store information in a plain text format. If any web application using cookies, Server  send  cookies and client browser will store it. The browser then returns the cookie to the server at the  next time the page is requested. The most common example  of using  a cookie is to store  User information, User  preferences , Password Remember Option etc. Cookies has many advantages and disadvantages. I will comes to this points , but first  have a look how cookies are started.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-5968658404109745956?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/5968658404109745956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/what-are-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/5968658404109745956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/5968658404109745956'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/05/what-are-cookies.html' title='What are Cookies ?'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-2265495861467036940</id><published>2009-04-30T03:11:00.000-07:00</published><updated>2009-04-30T03:24:54.794-07:00</updated><title type='text'>FileUpload control in ASP.NET web form using c#</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;FileUpload is very simple control allows user to select file and upload. &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;You can easily handle that with very little coding and ease. I have given the full code behind for this functionality.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;First create a aspx page with 3 controls&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;color:#ff0000;"&gt;FileUpload: rename it to FileUpload1&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;color:#ff0000;"&gt;Label: rename it to lblMsg&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="font-family:arial;"&gt;Button: &lt;/span&gt;&lt;span style="font-family:arial;"&gt;rename it to btnAdd&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Copy this code in your code behind file inside the class declaration. As you can see we are simply calling theSaveUploadedFile() function to save the uploaded file. you can check for the particular extension within the function right now we are checking for only 3 extensions. You can change it in sAllowedExt string.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Here is the code behind stuff:&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription0"  style="color:darkblue;"&gt;&lt;code&gt;&lt;pre&gt;&lt;span style="color:#3333ff;"&gt;String UPLOAD_PATH = "";&lt;br /&gt;int MAXSIZE = 5 * 1024 * 1024; // max 5 MB&lt;br /&gt;String sAllowedExt = ",.doc,.pdf,.xls,";  // make sure whatever extension you enter, string ends with comma&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    btnUpload.Attributes.Add("onclick", "return checkFile();");&lt;br /&gt;    UPLOAD_PATH = &lt;/span&gt;&lt;a class="kLink" oncontextmenu="return false;" id="KonaLink1" onmouseover="adlinkMouseOver(event,this,0);" style="POSITION: static; TEXT-DECORATION: underline! important" onclick="adlinkMouseClick(event,this,0);" onmouseout="adlinkMouseOut(event,this,0);" href="http://www.dotnetspider.com/resources/28093-FileUpload-control-ASP-NET-web-form-using-c.aspx.aspx#" target="_top"&gt;&lt;span style="FONT-WEIGHT: 400; POSITION: staticfont-family:Courier;" &gt;&lt;span class="kLink" style="FONT-WEIGHT: 400; COLOR: blue! important; BORDER-BOTTOM: blue 1px solid; POSITION: relativefont-family:Courier;color:#3333ff;"  &gt;Server&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#3333ff;"&gt;.MapPath("~/UploadedDocs") + "/";&lt;br /&gt;}&lt;br /&gt;private void setMsg(String sMsg)&lt;br /&gt;{&lt;br /&gt;    lblMsg.Text = sMsg;&lt;br /&gt;}&lt;br /&gt;protected void btnAdd_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        SaveUploadedFile();           &lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;        //Response.Write("Error: " + ex.Message);&lt;br /&gt;        setMsg("File could not be uploaded successfully.");       &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void SaveUploadedFile()&lt;br /&gt;{&lt;br /&gt;    if (FileUpload1.HasFile)&lt;br /&gt;    {&lt;br /&gt;        String fileExtension =  System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();&lt;br /&gt;        String validExt = ;&lt;br /&gt;        if (validExt.IndexOf("," + fileExtension + ",") != -1)&lt;br /&gt;        {               &lt;br /&gt;            if (FileUpload1.FileBytes.Length &amp;lt;= MAXSIZE)&lt;br /&gt;            {&lt;br /&gt;                FileUpload1.PostedFile.SaveAs(UPLOAD_PATH + FileUpload1.FileName);&lt;br /&gt;                setMsg("File uploaded successfully.");&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                setMsg("File size exceeded the permitted limit.");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            setMsg("This file type is not accepted.");&lt;br /&gt;        }&lt;br /&gt;    }       &lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;span style="color:#000000;"&gt;Once the user uploads the file, it's availabe using &lt;span style="color:#ff0000;"&gt;FileUpload.PostedFile.SaveAs()&lt;/span&gt; method. You can then directly save that file to particular folder with new name. We are checking FileUpload1.HasFileto make sure we only process if a file is uploaded.&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-2265495861467036940?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/2265495861467036940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/fileupload-control-in-aspnet-web-form.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2265495861467036940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/2265495861467036940'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/fileupload-control-in-aspnet-web-form.html' title='FileUpload control in ASP.NET web form using c#'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-4127924157127995889</id><published>2009-04-29T22:05:00.000-07:00</published><updated>2009-04-29T22:14:03.493-07:00</updated><title type='text'>ASP.NET event firing twice</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;color:#990000;"&gt;&lt;strong&gt;First Solution:&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;This seems to be a very common problem where by your event handler method gets run twice.&lt;br /&gt;It is caused by VS.NET inserting 2 wireup of the event handler:&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:arial;"&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;once in the aspx (HTML) eg: &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;?xml:namespace prefix = asp /&gt;&lt;asp:button onclick="btnTest_Click"&gt;and once in the VS.NET generated section (InitializeComponent) eg: &lt;/asp:button&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div align="justify"&gt;&lt;asp:button onclick="btnTest_Click"&gt;&lt;span style="color:#ff0000;"&gt;this.btnTest.Click += new System.EventHandler(this.btnTest_Click);&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The easiest solution, imo, is to simply remove the "OnClick..." HTML markup from the .aspx page.&lt;br /&gt;e.g: change this: &lt;span style="color:#ff0000;"&gt;&amp;lt; asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" &amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div align="justify"&gt;To this: &lt;span style="color:#ff0000;"&gt;&amp;lt; asp:Button ID="btnTest" runat="server" Text="Test" &amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div align="justify"&gt;Rebuild, and bingo! - 1 event per click.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#660000;"&gt;Second Solution:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="justify"&gt;I had the same problem, but none of the solutions above solved my problem..I was using HTML controls on my aspx page like &lt;span style="color:#ff0000;"&gt;&amp;lt; button runat="server" id="btnNext" type="submit" onserverclick="btnNext_Click" &amp;gt;&lt;/span&gt; The solution for me was to change the type="submit" to type="button". &lt;/p&gt;&lt;/asp:button&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-4127924157127995889?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/4127924157127995889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/aspnet-event-firing-twice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/4127924157127995889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/4127924157127995889'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/aspnet-event-firing-twice.html' title='ASP.NET event firing twice'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2253622342005515043.post-7802061360351471273</id><published>2009-04-29T20:57:00.000-07:00</published><updated>2009-04-29T21:08:56.244-07:00</updated><title type='text'>Large file uploads in ASP.NET</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;Uploading files via the &lt;/span&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx"&gt;&lt;span style="font-family:arial;"&gt;FileUpload&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt; control gets tricky with big files. The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Increasing the Maximum Upload Size&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The 4MB default is set in machine.config, but you can override it in you web.config. For instance, to expand the upload limit to 20MB, you'd do this:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:georgia;color:#ff0000;"&gt;&amp;lt;system.web&amp;gt; &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:georgia;color:#ff0000;"&gt;     &amp;lt;httpRuntime executionTimeout="240" maxRequestLength="20480"&lt;/span&gt;&lt;span style="font-family:georgia;color:#ff0000;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:georgia;color:#ff0000;"&gt;&amp;lt;/system.web&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;Since the maximum request size limit is there to protect your site, it's best to expand the file-size limit for specific directories rather than your entire application. That's possible since the web.config allows for cascading overrides. You can add a web.config file to your folder which just contains the above, or you can use the &lt;location&gt;tag in your main web.config to achieve the same effect:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&amp;lt;location path="Upload"&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&amp;lt;system.web&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;     &amp;lt;httpRuntime executionTimeout="110" maxRequestLength="20000" /&amp;gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;/system.web&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&amp;lt;/location&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2253622342005515043-7802061360351471273?l=dotnetcontact.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcontact.blogspot.com/feeds/7802061360351471273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/large-file-uploads-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7802061360351471273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2253622342005515043/posts/default/7802061360351471273'/><link rel='alternate' type='text/html' href='http://dotnetcontact.blogspot.com/2009/04/large-file-uploads-in-aspnet.html' title='Large file uploads in ASP.NET'/><author><name>MYK</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
