Sunday, May 23, 2010

Difference between Application, Session, ViewState and Cache objects

Session has a Session ID which is created for every user so if the user request the web application, then a session ID will be created for this user and if he/she exits from the web application, the Session ID will be lost and a new one will be created if he/she requests the web application again.

While in Application object once the first user requests the web application, the application object will be created and maintained till the last user exits from the web application

ViewState is a technique used in ASP.NET to keep the values or settings applied to ASP.NET Server controls persistant during round trips between client and server.

You can check the ViewState object in the source code of the page, it's encrypted so users can never watch what is really written in there.

It's really recommended to disable unused ViewStates on some of ASP.NET Server controls like Labels by going to any server control and set the EnableViewState property to false

Cache is a technique used in data that takes long times to be retrieved e.g. data that has not been changed and is retrieved from SQL Server database and with Caching data is going to be retrieved from memory.

Just to let you know, caching an object or a page has three restrictions to trigger the server to disregard getting the data from memory and to enforce retrieving the data from the page, it should be used in certain circumstances to ensure that users will get the latest data.

Saturday, May 22, 2010

Tips and Tricks for any ASP.NET developers to study and learn

The reason I write here in my blog, is to document all my experience about ASP.NET tips and tricks, I found it during many interviews I had, actually I didn't count them during my last year of 2009 when I was laid off, I did NOT know how to answer employers' questions on many topics regarding .NET framework, ASP.NET, C#, VB.NET and MS SQL Server 2005 or 2008.

The fact that I really know that all these employers' questions don't mean that I'm not expert in coding .NET desktop and web applications but they don't care they want quick and precise answers to see if they can really hire me or look for someone else.

So I realized that I can write down a couple of questions after every interview and search for quick answers, study them or memorize them if you want the exact term, I figured out that it's about my memory where I began to really feel down because every interview I go there I had been asked the same questions over and over, some of them I succeeded to answer them and some I couldn't so I solved my problem by writing all my thoughts in a word document, then categorize them into different aspects in IT.

Anyway I ended up having a document of more than 250 pages of frequently asked questions during my last hundreds of interviews, well to make the story short, I got a job recently as an ASP.NET Web Application Developer and I know that every programmer they search the internet or use MSDN during their daily coding work but employers they don't really care because they can't decide if you're the right candidate or not within a very short period of time usually it's 30 minutes of time so I decided to write everything in my own style which I really couldn't answer it to help me have a solid knowledge and understanding in the IT field.

I encourage everyone to contribute with questions and programming challenges in the Microsoft world.