<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET Brisbane, Australia : asp.net</title><link>http://weblogs.asp.net/edgepereira/archive/tags/asp.net/default.aspx</link><description>Tags: asp.net</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>The 300 Model</title><link>http://weblogs.asp.net/edgepereira/archive/2008/05/28/the-300-model.aspx</link><pubDate>Wed, 28 May 2008 05:36:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6226333</guid><dc:creator>superedge</dc:creator><author>superedge</author><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/edgepereira/rsscomments.aspx?PostID=6226333</wfw:commentRss><comments>http://weblogs.asp.net/edgepereira/archive/2008/05/28/the-300-model.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;"Surrender, we are many, you are few. We won't lay down our weapons, you want them? Come get them! The Persians arrows will blot out the sun. Better this way, we will fight in the shadow."&lt;/em&gt;&lt;/strong&gt;

&lt;/p&gt;&lt;p&gt;The movie &lt;strong&gt;‘300’&lt;/strong&gt; is like a big punch in the stomach and you have no time to fall. In '300', you see a comic book story that meets the entrepreneurship that meets the world history about the legendary &lt;strong&gt;battle of Thermopylae&lt;/strong&gt; during the year of 480 BC where only 300 Spartans fought against millions of Persians for the future of Greece. Nobody knows exactly how many were really involved in the war; but everyone agreed: &lt;strong&gt;It was few against many!&lt;/strong&gt;

&lt;/p&gt;&lt;p&gt;Based on &lt;strong&gt;Frank Miller's&lt;/strong&gt; graphic novel, the movie in its first week generated &lt;strong&gt;USD 70 millions in USA alone&lt;/strong&gt;, with no Tom Cruise, Brad Pitt or a big-shot Hollywood star; instead the major roles were &lt;i&gt;'unkowns'&lt;/i&gt;'; a Scottish called &lt;a href="http://imdb.com/name/nm0124930/" mce_href="http://imdb.com/name/nm0124930/"&gt;Gerard Butler &lt;/a&gt;as &lt;strong&gt;King Leonidas&lt;/strong&gt; and a Brazilian called &lt;a href="http://imdb.com/name/nm0763928/" mce_href="http://imdb.com/name/nm0763928/"&gt;Rodrigo Santoro &lt;/a&gt;as &lt;strong&gt;King Xerxes&lt;/strong&gt;.

&lt;/p&gt;&lt;p&gt;Some might say that people go to see this movie because it shows &lt;strong&gt;sexy appealing scenes, rock music, violence and amazing special effects&lt;/strong&gt;.

That's a lie!

&lt;/p&gt;&lt;p&gt;This movie captures the audience because it is about the eternal battle between the &lt;strong&gt;strong and the weak, between heroes and villains, between common people and powerful kings&lt;/strong&gt;. This movie attracts people because every single one wants to know &lt;strong&gt;how to defeat a much powerful competitor when we have only too few resources; how to conquer the market when we have few people; how to make more out of few&lt;/strong&gt;.

&lt;/p&gt;&lt;p&gt;‘300’ is a bloody battle between a little small company carried on the shoulders of very talented warriors committed by the honor and a huge corporation machine maintained by millions of regular employees who, some of them, do not even know what are they doing in the company or why they are doing that.

&lt;/p&gt;&lt;p&gt;This movie offers much more insights for your professional life than many MBA courses around there. Save yourself USD 500 and watch the movie for a few dollars.&lt;/p&gt;&lt;p&gt;You will learn :&lt;/p&gt;&lt;ul&gt;&lt;li&gt;a &lt;i&gt;&lt;strong&gt;lesson about the leader who inspired others&lt;/strong&gt;&lt;/i&gt; &lt;em&gt;(even to admire him until his last breath)&lt;/em&gt;, &lt;br&gt;&lt;/li&gt;&lt;li&gt;you will learn about how to start a company where everyone wants to work on 24x7 &lt;em&gt;(until their last moments)&lt;/em&gt;, &lt;br&gt;&lt;/li&gt;&lt;li&gt;How to create a brand, a history, a legend &lt;em&gt;(that will overcome the death)&lt;/em&gt;. &lt;br&gt;&lt;/li&gt;&lt;li&gt;When the captain decides to punish the soldier, &lt;i&gt;&lt;strong&gt;Leonidas&lt;/strong&gt; &lt;/i&gt;- the Spartan King - teaches the manager the value of respect towards the lower ranks.&lt;/li&gt;&lt;li&gt;When in doubt of his own convictions, Leonidas asks his partner’s opinion, wife, and Queen &lt;em&gt;- who always is treated equally as any other man -&lt;/em&gt; about how to deal with the business. &lt;br&gt;&lt;/li&gt;&lt;li&gt;When busy, just a few days before facing millions and certain death, he finds himself quality time to spend with his little son and teach him the secrets of the business world that he knows so well. &lt;br&gt;&lt;/li&gt;&lt;li&gt;When ready for battle, tie, computer and mobile, everything he does is to &lt;i&gt;&lt;strong&gt;KEEP FOCUS ON THE REASON&lt;/strong&gt;&lt;/i&gt; to make the best for the business and his employees.&lt;/li&gt;&lt;li&gt;When King Xerxes, try to seduce Leonidas with the benefits of a possible merge &amp;amp; acquisition of the little Spartan company by the mega-corporation Persia will bring to the shareholders, for him &lt;em&gt;(by becoming CEO of Greece, palaces, women, higher salaries)&lt;/em&gt; and for his employees &lt;em&gt;(who will set themselves free from slavery)&lt;/em&gt;, Leonidas reminds Xerxes that the &lt;i&gt;&lt;strong&gt;true slavery of the human being it is not the economical slavery or social, but is to lose the Spartan life style, their culture, their philosophy and the right to take decisions freely without need to justify to nobody&lt;/strong&gt;&lt;/i&gt;. &lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;In every scene you can learn something about you!&lt;/p&gt;&lt;p&gt;Forget the popcorn and the soft drinks, &lt;i&gt;&lt;b&gt;concentrate on the dialogues&lt;/b&gt;&lt;/i&gt;.

&lt;/p&gt;&lt;p&gt;When the Spartan board of directors decides to surrender to Xerxes by not supporting Leonidas, they take the army command out from Leonidas, and tell him to kneel and behold the invisible; Leonidas instead, he does a spin-off in the army, creates himself his &lt;strong&gt;own company&lt;/strong&gt;, he gathers 300 of his best soldiers and go to war against Xerxes' millions. &lt;/p&gt;&lt;p&gt;When he is asked about how he will defeat millions with just 300 soldiers he says &lt;i&gt;&lt;strong&gt;he will use his brain when Xerxes uses his ego&lt;/strong&gt;&lt;/i&gt;. He moves towards &lt;em&gt;&lt;strong&gt;Thermopylae&lt;/strong&gt;&lt;/em&gt;, a narrow passage where it will neutralize the enemy superiority in numbers.

&lt;/p&gt;&lt;p&gt;When an incapable and mediocre Spartan asks him to join the army, Leonidas tells him to go home; in the other hand, Xerxes is sending his mediocre to the front to die first. In Leonidas' small company, &lt;i&gt;&lt;strong&gt;only the best, the braves and the brilliants are accepted&lt;/strong&gt;&lt;/i&gt;. He left out the weak, the average, and the non-team players. &lt;/p&gt;&lt;p&gt;Interesting,&lt;strong&gt; &lt;i&gt;he brings all the married men with at least one son, meaning these are the most committed people when compared against young and singles&lt;/i&gt;&lt;/strong&gt;. He does not want anybody to slow down his bests and show weakness to the enemy. He can not afford it. &lt;/p&gt;&lt;p&gt;During a very important moment of the battle, Leonidas meets Xerxes, the &lt;em&gt;God-King&lt;/em&gt; asks: &lt;strong&gt;&lt;em&gt;"How do you envision defeating me? I would kill anyone of my own men just to have you killed"; "I would die for anyone of my own men" Leonidas says&lt;/em&gt;&lt;/strong&gt;.

&lt;/p&gt;&lt;p&gt;When Leonidas notices that he will not be able anymore to defeat Xerxes' army, he decides to &lt;strong&gt;build a brand!!!&lt;/strong&gt; He sends just one of your soldiers back home with a mission to make sure everyone knows about of what happened there and the history and glory of those 300 Spartans will live forever.

2.500 years later in the other side of the planet here we are talking about those 300 warriors. &lt;strong&gt;&lt;em&gt;"The whole world will know that a handful of free men fought to their death against the tyranny, the whole world will know that few stand against many."&lt;/em&gt;&lt;/strong&gt;

&lt;/p&gt;&lt;p&gt;The &lt;strong&gt;marketing&lt;/strong&gt; started by Leonidas worked. This viral inspired millions of Spartans, and produced the necessary proud to unite the Greek world who later ended the Persian invasion and Greece was never defeated by them in this war. And because of that, a new regime was being born, the &lt;strong&gt;Democracy&lt;/strong&gt;.

&lt;/p&gt;&lt;p&gt;The Spartan society left nothing behind except the stories of their battles. No art, no music, no dance, no knowledge, no invention, no technology to enlighten the path...they left the unconditional dedication and the strong discipline of his people to become the &lt;strong&gt;best warriors ever seen in this world as legacy&lt;/strong&gt;.

Sparta did not produced an Einstein, a Michelangelo, or a Leonardo da Vinci, but they gave birth to the expression &lt;strong&gt;"Spartan Life"&lt;/strong&gt; that is today related to the lifestyle where a person give up privileges and personal benefits to embrace &lt;em&gt;(with body, mind and soul)&lt;/em&gt; and surrender his life to a higher cause. &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6226333" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/edgepereira/archive/tags/team+system/default.aspx">team system</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net/default.aspx">.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/general+software+development/default.aspx">general software development</category></item><item><title>File Upload and Canonical Issues</title><link>http://weblogs.asp.net/edgepereira/archive/2008/05/02/file-upload-and-canonical-issues.aspx</link><pubDate>Fri, 02 May 2008 03:57:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6149205</guid><dc:creator>superedge</dc:creator><author>superedge</author><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/edgepereira/rsscomments.aspx?PostID=6149205</wfw:commentRss><comments>http://weblogs.asp.net/edgepereira/archive/2008/05/02/file-upload-and-canonical-issues.aspx#comments</comments><description>&lt;p align="justify"&gt;Never trust the user input. The incoming data can be the source of many devils and a security flaw can be there just waiting for the right moment and the right person to break your application.&lt;/p&gt;  &lt;p align="justify"&gt;After finishing &lt;a href="http://weblogs.asp.net/edgepereira/archive/2008/04/19/uploading-files-and-raising-events.aspx" mce_href="http://weblogs.asp.net/edgepereira/archive/2008/04/19/uploading-files-and-raising-events.aspx"&gt;my upload control&lt;/a&gt; I finally did the integration with the website. Now the users can select the files and send it to the website to be processed.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/superedge/SCB9HW3jD_I/AAAAAAAABbI/oPtg2L0_DYo/s1600-h/1%5B6%5D.gif"&gt;&lt;img src="http://lh4.ggpht.com/superedge/SCB9IG3jEAI/AAAAAAAABbQ/6mP14AYyf2k/1_thumb%5B4%5D.gif?imgmax=800" style="border-width: 0px;" alt="1" border="0" height="133" width="336"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;What are the security risks here? Something that can be called 'canonicalization issue'.&lt;/p&gt;  &lt;p align="justify"&gt;For a start all data can be seen on its canonical form. A canonical form is the most simple and most stardard form that any data can be represented, thus canonicalization is the process of converting the data to its canonical form.&lt;/p&gt;  &lt;p align="justify"&gt;Proficient JavaScript programmers are very aware of what I am talking about, and as a matter of fact in our system the user can search for a name using wildcards. So you can ask him: &lt;i&gt;"Retrieve me a list of all the instances where its canonical form includes Bill as mandatory prefix" &lt;/i&gt;The user will probably say: &lt;i&gt;"Retrieve what???"&lt;/i&gt; but if you ask them: &lt;i&gt;"Give me a list of all the users where their names start with Bill"&lt;/i&gt; they will type in the system 'bill*'. The user normally does not know that but he is doing is performing a &lt;i&gt;'type of canonical query'&lt;/i&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;Now, back to our file upload issue. A file name is a very common canonical type. You can call the same file as:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;thairecipes.doc&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;c:\recipes\thairecipes.doc&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;c:\\recipes\\thairecipes.doc&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;c:\&amp;nbsp;&amp;nbsp; recipes\thairecipes.doc&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;c:%3A%5Crecipes%5Cthairecipes.doc        &lt;br&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;As you probably figured the last one is the issue. Your Windows operating system will recognize the symbols %5C and %3A.&lt;/p&gt;  &lt;p align="justify"&gt;You see now because we are giving to the user the option to save in our system just about any file name he wants to at the same time we are also opening a door for a sort of canonical attack. Remember : Never trust the user. And by user I am not only talking about a person. In our context an user is any entity who uses a given resource or service, and for that matter an user indeed can be another system or another application.&lt;/p&gt;  &lt;p align="justify"&gt;A hacker would think: "how can I break into this site? Does it allow any easy access to any of its resources?". In our case, yes our website must allow the user to upload files. &lt;/p&gt;  &lt;p align="justify"&gt;What to do now? How to handle a file upload to a web server?&lt;/p&gt;  &lt;p align="justify"&gt;Well, first as a general rule you must not design a website that accept just about any file names created by the user and save it like that. As a matter of fact, any input must be validated and sanitized&amp;nbsp; if possible, not only in client-side but on the server-side as well. &lt;/p&gt;  &lt;p align="justify"&gt;A better design: Do not allow the user to save the file in the web server with the filename that he wants to use. Accept the file, keep the original filename somewhere and let the application rename that file with another name and then save it. I would suggest you to use a GUID string for that matter. That way you are not only closing the doors for a possible canonical attack but also you do not give a chance to a malicious user to try to find out the filenames you might have in your server. For example, If a hacker knows that there is a file called http:\\mywebsite\mydocs\clientid1\&lt;b&gt;file1.doc&lt;/b&gt; he will try something like http:\\mywebsite\mydocs\clientid1\&lt;b&gt;file2.doc&lt;/b&gt;, and then http:\\mywebsite\mydocs\clientid1\&lt;b&gt;file3.doc&lt;/b&gt; and so on. By using an internal name rule creation you minimize his surface.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/superedge/SCB9JG3jEBI/AAAAAAAABbY/2UWyaE6w8X0/s1600-h/2%5B5%5D.gif"&gt;&lt;img src="http://lh4.ggpht.com/superedge/SCB9KG3jECI/AAAAAAAABbg/xTOfyAorsSg/2_thumb%5B3%5D.gif?imgmax=800" style="border-width: 0px;" alt="2" border="0" height="248" width="491"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Another thing to observe: You don't have to fight against and defeat a malicious user, probably there can be hundreds of hackers trying to break your code and you are just one guy against them &lt;i&gt;( and you don't want to have any sleepless nights during weekends, do you? )&lt;/i&gt; They always find a way to break your code. The best option is to minimize their attack surface. Chances are they are going to move on and concentrate their efforts to break a "weaker website" if your site if strong enough for the first rounds of attack.     &lt;br&gt;    &lt;br&gt;These would be some instinctive considerations and additionally I would suggest to take a look at implementing &lt;a href="http://msdn.microsoft.com/en-us/library/aa302423.aspx" mce_href="http://msdn.microsoft.com/en-us/library/aa302423.aspx"&gt;File I/O guidelines&lt;/a&gt; as well. At the end of the day, it all depends about how secure you want to be, how much time you have available to implement it and how rigid the specifications were given.&lt;/p&gt;  &lt;p&gt;See you later.&lt;/p&gt;  &lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6149205" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/edgepereira/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net/default.aspx">.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/general+software+development/default.aspx">general software development</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net+faq/default.aspx">.net faq</category></item><item><title>Why adding more memory won't fix your Out of Memory error ?</title><link>http://weblogs.asp.net/edgepereira/archive/2008/04/05/why-add-more-memory-won-t-fix-your-out-of-memory-error.aspx</link><pubDate>Sat, 05 Apr 2008 15:52:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6069116</guid><dc:creator>superedge</dc:creator><author>superedge</author><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/edgepereira/rsscomments.aspx?PostID=6069116</wfw:commentRss><comments>http://weblogs.asp.net/edgepereira/archive/2008/04/05/why-add-more-memory-won-t-fix-your-out-of-memory-error.aspx#comments</comments><description>&lt;p align="justify"&gt;Here an interesting case. Consider there 2 scenarios:&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm3.static.flickr.com/2001/2389271787_9ba084337c.jpg" mce_src="http://farm3.static.flickr.com/2001/2389271787_9ba084337c.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Both are running the same website, both have the same amount of users connected.&lt;/p&gt;  &lt;p align="justify"&gt;Now imagine this website has a page to upload pictures, just like any regular photo-album website.&lt;/p&gt;  &lt;p align="justify"&gt;For some reason, at some point the users complain that they see an error page indicating out of memory error. &lt;/p&gt;  &lt;p align="justify"&gt;So, you wonder: &lt;i&gt;How come? they are just uploading a photo to my website, and I still have plenty of memory in my server anyway&lt;/i&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;Anyhow, you stop thinking about this and go for the &lt;i&gt;easiest, quick and dirty &lt;/i&gt;solution: If the system tells me that my computer does not have enough memory then &lt;b&gt;I just need to add more memory&lt;/b&gt;. Right?&lt;/p&gt;  &lt;p align="justify"&gt;And guess what? you still will get the error message.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm3.static.flickr.com/2220/2390103968_2c86acc65f.jpg" mce_src="http://farm3.static.flickr.com/2220/2390103968_2c86acc65f.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;That's a very common mistake. Having a machine with 10GB of memory does not mean you will have 10GB of memory available. I explain.&lt;/p&gt;  &lt;p align="justify"&gt;It does not matter if your computer or server has 512 MB, 1 GB, 2 GB, 4 GB or 8 GB of RAM. If your machine is a 32-bit machine it will only be able to see/manage 4 GB. That's mathematics, that's life, that's the way things are and you can't do nothing about it. A 32-bit machine can not do more than that.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm4.static.flickr.com/3030/2390103346_8be8580061.jpg" mce_src="http://farm4.static.flickr.com/3030/2390103346_8be8580061.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Additional memory may increase your system performance, but it won't increase the memory availability. Sure your computer will use less the hard disk for swapping operations and will be able put more stuff in memory and start some programs faster, but 4GB is the limit; after this point the memory management module will start doing disk swap and to use the famous page file.&lt;/p&gt;  &lt;p align="justify"&gt;And here comes more bad news: Your Windows system on a 32-bit machine requires 2 GB allocated only for it. &lt;/p&gt;  &lt;p align="justify"&gt;So, if you have 4 GB installed, effectively you will have 2 GB only for applications; your windows will be using alone 2 GB.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm4.static.flickr.com/3141/2390103884_02673e964a.jpg" mce_src="http://farm4.static.flickr.com/3141/2390103884_02673e964a.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;So, what does out of memory means?&lt;/p&gt;  &lt;p align="justify"&gt;Well, according to some people at Microsoft, this limit for an average configuration is reached between 600 MB and 800 MB of utilization. That 800 number is NOT A RULE, is a baseline. Generally speaking the largest majority of configurations with website, .NET and SQL Server database might have a problem around this point. Of course, this can vary from system to system...as a matter of fact a system can be out of memory at just 600 MB.&lt;/p&gt;  &lt;p align="justify"&gt;Yes, it does sounds crazy. You look so happy now that you just bought a 4GB RAM notebook and your computer is breaking with just 800MB, hun?&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm3.static.flickr.com/2347/2390103928_2612aa2f3d.jpg" mce_src="http://farm3.static.flickr.com/2347/2390103928_2612aa2f3d.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Here is another point for you. Have you ever seen someone bragging that he/she bought a 10-megapixel camera and now he/she believes their pictures are going to be better because of this?&lt;/p&gt;  &lt;p align="justify"&gt;Well, guess what? Just like the number of megapixels in a camera box does not have much to do with picture quality, RAM memory does not have much to do with hard disk space.&lt;/p&gt;  &lt;p align="justify"&gt;That's a common mistake: &lt;b&gt;&lt;i&gt;People buy RAM as if they were buying a hard disk&lt;/i&gt;&lt;/b&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;RAM usage needs to me continuous, unlike hard disk. A simple 5MB Microsoft Word document when saved in a hard disk can be split up in hundreds of pieces; When you open this file in memory, the RAM requires those 5MB to be allocated continuously.&lt;/p&gt;  &lt;p align="justify"&gt;Can you see now the reason for the 'out of memory' message?&lt;/p&gt;  &lt;p align="justify"&gt;Yes, it really means &lt;i&gt;&lt;b&gt;'there is not enough continuous memory to place that file in memory'&lt;/b&gt;&lt;/i&gt;. Your system might have 2GB of RAM but unfortunately it might be too busy with stuff running and there is no enough continuous memory to put the picture you are uploading.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img src="http://farm3.static.flickr.com/2042/2390103910_1bc0b92982.jpg" mce_src="http://farm3.static.flickr.com/2042/2390103910_1bc0b92982.jpg"&gt; &lt;/p&gt;  &lt;p align="justify"&gt;Yeah, you can not do much but you can buy a 64-bit machine then when you add more memory you can really use it more efficiently. And yes, we have &lt;a href="http://www.microsoft.com/windows/" mce_href="http://www.microsoft.com/windows/"&gt;Microsoft Windows systems for 64-bit machines&lt;/a&gt;.&lt;/p&gt;  &lt;p align="justify"&gt;If you do not want to buy a new system of upgrade you current server to a better version then you should think other solutions in the business process, such as to avoid users upload pictures with more than 1 MB in size to be uploaded.&lt;/p&gt;  &lt;p align="justify"&gt;See you later.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6069116" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/edgepereira/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net/default.aspx">.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/general+software+development/default.aspx">general software development</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net+faq/default.aspx">.net faq</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/vista/default.aspx">vista</category></item><item><title>ASP.NET Login is lost when I refresh the page. How come?</title><link>http://weblogs.asp.net/edgepereira/archive/2008/02/25/asp-net-login-is-lost-when-i-refresh-the-page-how-come.aspx</link><pubDate>Mon, 25 Feb 2008 13:58:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5859460</guid><dc:creator>superedge</dc:creator><author>superedge</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/edgepereira/rsscomments.aspx?PostID=5859460</wfw:commentRss><comments>http://weblogs.asp.net/edgepereira/archive/2008/02/25/asp-net-login-is-lost-when-i-refresh-the-page-how-come.aspx#comments</comments><description>Hi guys,
&lt;p&gt;Here another interesting problem. Crazy logins loosing their tokens. I had a chat with a friend that happens to work in an online shop website. He knew that I've developed once the authentication/authorisation mechanism for a similar company then he asked me that: &lt;/p&gt;

&lt;p&gt;&lt;i&gt;Edge, my ASP.NET website was running fine using SQLExpress 2005. My development and test environments are fine and my tests look OK, but since I moved my website to a better host using SQL Server 2005 I keep getting complaints from my customers; they say all of sudden while navigating the website they get logged out and because of that they are forced to login again. Just like that, out of nowhere. They say they can even add items to the shopping cart but when they start navigating&amp;nbsp; the catalog somehow they realize they are not logged in anymore. That's causing me a lot of stress because ultimately I am loosing revenue. So I am suspecting that it could be some page that is forcing them to logout or doing some crazy redirect. I don't know. &lt;br&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;But wait, there is more. Some customers say that after they are logged out, they wait a few minutes and then they refresh the page. They say this will bring their login back (???) Tha's crazy. How come they are logged in my website, then they get kicked out, then a few minutes later they are automatically logged back in? &lt;/i&gt;&lt;i&gt;The only new variable is the SQL Server 2005. Is this a MS SQL Server 2005 bug?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;My dear friends, I completely understand this case and I know the pain to debug and trace such a environment. Sometimes these problems can drives us crazy during long weekend nights. &lt;/p&gt;

&lt;p&gt;So here a little diagram for us to start our case study:&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;center&gt;&lt;img src="http://farm4.static.flickr.com/3215/2290749275_f9036a8cdc_o.jpg" mce_src="http://farm4.static.flickr.com/3215/2290749275_f9036a8cdc_o.jpg" align="middle" height="178" width="469"&gt;&lt;/center&gt;&amp;nbsp;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;center&gt;&lt;img src="http://farm4.static.flickr.com/3067/2290749277_ef1a114f0c_o.jpg" mce_src="http://farm4.static.flickr.com/3067/2290749277_ef1a114f0c_o.jpg" align="middle" height="155" width="470"&gt;&lt;/center&gt;&amp;nbsp;



&lt;p style="text-align: justify;"&gt;&lt;span&gt;So his environment is a &lt;a href="http://asp.net/" target="_blank"&gt;ASP.NET&lt;/a&gt; website setup on a web farm, running IIS and having as backend a single instance of SQL Server 2005. The users were able to login to the website but then after a page
refresh, that could not be determined for sure when or where, they get logged out. According to him, the only new variable was the setup of a new SQL
Server, since before he was running using SQL Express; Interesting to note here:
you might be surprised to see how many people actually can use SQLExpress as
their backend. Based on that, I had a feeling that it was not going to be a code
issue, but most likely a setup or environment issue. &lt;/span&gt;&lt;/p&gt;

&lt;p style="text-align: justify;"&gt;&lt;span&gt;I noted that he heavily uses &lt;a href="http://asp.net/" target="_blank"&gt;ASP.NET&lt;/a&gt; Sessions tables for his product. So, this gave me a good clue for us to look at the problem.&lt;/span&gt;&lt;/p&gt;


&lt;p style="text-align: justify;"&gt;&lt;span&gt;For those who don't believe me, &lt;/span&gt;&lt;a href="http://asp.net/" target="_blank"&gt;ASP.NET&lt;/a&gt; session state really
works &lt;span&gt;&amp;nbsp;&lt;/span&gt;flawlessly on web farms. If you
have one and are not using it, I would say : give it a go. And I would go even further, use a
database to store the session state. It does not have to be SQL Server database,
it can be a MySQL, for example. I highly recommend MS database anyway. Why? Because
if you use SQL Server&lt;span&gt;&amp;nbsp; &lt;/span&gt;you can replicate
the database and it is going to integrate beautifully with you &lt;a href="http://asp.net/" target="_blank"&gt;ASP.NET&lt;/a&gt; application.
&lt;span&gt;&amp;nbsp;&lt;/span&gt;Try to do this using any other database
and you are in big trouble. (Or not, if you don't like weekends with the family anyway). Now add to this the amazing
caching capabilities provided by SQL Server 2005. My friend, you are set for a
very stable environment.&lt;/p&gt;

&lt;p style="text-align: justify;"&gt;His host provider uses &lt;a href="http://asp.net/" target="_blank"&gt;ASP.NET&lt;/a&gt; session in a web farm and a load balancer. Now we
saw a likely breaking point. Did he setup correctly the web.config file for the new environment? Did he make sure all the servers were running the required service for state server? Ultimately, of course, we should rely in the hosting company to do this for us, but double-check just in case before doing any release like this one.&lt;br&gt; &lt;/p&gt;

&lt;p style="text-align: justify;"&gt;So, in my head I pictured this: The
user was going back and forth, loosing and getting back his login token. Like
if every time he did a refresh, his request would be transferred to another
server which did not have the state server running, therefore no information
about his login.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;img src="http://farm3.static.flickr.com/2183/2290749279_a7c7526299_o.jpg" mce_src="http://farm3.static.flickr.com/2183/2290749279_a7c7526299_o.jpg" align="absmiddle" height="130" width="474"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p style="text-align: justify;"&gt;Then he refreshed again at some
point, his request was redirected to a machine with the state server running,
and the login was back again.&lt;/p&gt;

&lt;p style="text-align: justify;"&gt;We tried this. Double-checked if
the web.config was correct for state servers and we made sure that every server
in the farm had the service on. The infra-guy fixed those and voilla…back in
business.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;img src="http://farm3.static.flickr.com/2148/2290749285_7be1ef3815_o.jpg" mce_src="http://farm3.static.flickr.com/2148/2290749285_7be1ef3815_o.jpg" align="middle" height="212" width="472"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p style="text-align: justify;"&gt;Hopefully this was the solution. So far, so good. &lt;/p&gt;&lt;p style="text-align: justify;"&gt;See ya later.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5859460" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/edgepereira/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/.net/default.aspx">.net</category><category domain="http://weblogs.asp.net/edgepereira/archive/tags/sql+server/default.aspx">sql server</category></item></channel></rss>