Archive for the ‘IIS’ Category

ViewState and Server Controls ASP.NET PageLifeCycle

How does view state data value assigned to controls on Html form or How user inputs value retained after post back.

This is all above comes in PageLifeCycle and we can find many articles on that. I have small understanding on very important thing and I would like share..

When Post Back happens or any server side event fired their are major event which plays role to retain data of view state.
LoadPostBackData – This function is only applicable for Postback. When the page is given to asp.net engine with all markup asp.net engine calls for several functions to complete the server side load.
Browser on event firing or postback will pass on the values to ASP.NET engine using HTTP POST header which actually has _VIEWSTATE.
IPostBackDataHandler interface will take care of calling LoadPostdata function for all the server controls for which loading view state is applicable.All listed controls in IPostBackDataHandler will have call for LoadPostdata () method like textbox, listbox. So here we can see that its not viewstate which is only responsible for loading user input to controls.

Page Load – In this event the load view state happens along with post back data.

Save View State -In this stage Page class construct View State for page which has to be maintained across post back. It is called according to the hierarchy defined in Page Instantiation for all the controls(stored in the WINDOWS\Microsoft.NET\Framework\version\Temporary ASP.NET Files).

Very nice explanation of page life cycle and role of view state is written here

Happy programming..

Number of View :738

No Comments


.Net Application With Windows Azure 1.8

Now I have Installed Windows SDK 1.8 kit and started developing asp.net application using video shown in MSDN. But the catch is it is old and the configuration or publishing site ways are improved.

To develop ASP.NET application on VS2010 follow steps as below
1) Open VS 2010 -> File Menu -> New -> Project
2) Under Project window you can see various language and options, I am selecting c# and then Cloud here you see at right Panel is Windows Azure Cloud Service

VS 2010- Project- Cloud

VS 2010- Project- Cloud

3) Give name and location of project to save.
4) Next step it will open window to select the project type

Select Cloud Project Type

Select Cloud Project Type

But why is project type with Role like Web, Worker and VM? In short they are nothing but your Web Configuration role. Like you want use IIS for application, you want to run it locally with worker process or using VM… you can find good explanation in msdn,
Have patience here it takes time to get your code files service files to be generated.
Project With all file
4) Now you can do implementation in your project which is of WebRole type.
5) Ones you are ready for hosting of course we will do it on windows azure, select WebRole Project Properties -> Publish to Windows Azure
6) Now here your Windows Azure journey starts , Create Login in if you have already use it. When you try for Trial you still need to provide your bank account details. When you come to Publish First windows will be asking Import credentials which you have, If you have not saved your Credentials from Windows azure login save it by choosing Sign in to download credentials.
Sign in Windows azure

Click Next.
7) Here you need to fill correct details. Read about Windows azure before you do settings in publish.
Options for Create Cloud Publish

As per above image you need to specify Cloud Service(Select Create New from drop-down and give name and location) Name which we give here will become your URL. Provide all other details as well.
8) Go to Advanced Setting Tab and create New Storage Account.
9)Click on Publish.. and Wait for Status in task bar of your project as completed.
This time here it will perform connection with Windows Azure and create your application.
10) Ones you have no failure and Status shows as Completed you can click the URL given in output results and browse.

few steps are different than the videos given by msdn.

Happy Programming..

Number of View :4061

Tags: , , ,

No Comments


Windows azure Cloud .Net Applications

Hmm. . Starting late when Microsoft has already come up with most of the latest versions on their own Cloud that is Windows Azure.
 
Today I got time to go through some of the videos available in MSDN and came to know how cloud works in Windows Azure providing extensions to all available application templates which are heavily used like ASP.NET, Windows Forms, MVC, WCF, SQL. Watching videos gives feeling that Cloud or Windows Azure is simple and I can straight away go ahead create my application in Azure but I am beginner in this so hurdles are sure in starting.

So what I have faced and How I Solved
Problem: I could not get Windows Azure SDK installed on VS 2010 ultimate version.
Reason: Error specified that I had nugets of MVC3 updates installed which are not compatible. It means still some more opportunities to Microsoft for giving fix or Patch.

It is true that I installed MVC4 not MVC3 but it had latest updates which I installed from Nugets option available in VSTF Extension Manager under tools. Why this issue? I am not sure.

I would like to share what I learnt in Videos

Setup environment for Windows Azure by installing Windows Azure SDK latest version 1.8
Create new application under Cloud same way you create without using cloud.
Publish it using options available in properties.
Host it in Windows Azure using your lab account if you do not have it create Trial one.
Deploy it on Windows Azure region.
Execute or Browse it.

If I am not wrong Cloud concept is available from the time Domain has come into picture. Some one is providing domain as well as host server environment and user is just publishing deploying the package.
But Cloud is more advanced gives you more features which are important for Development team like Building, Configuration, Different Data Source management, Versioning many more.

Now above all steps are possible if you are already familiar with .NET.

Lets go back to the problem I had and solution
So here is the solution I followed.
I read FAQ and googled it but could not get the working solution where I can keep MVC4 and then Install Windows Azure. If anyone reading this article and found right solution please do comment.

Solution: I uninstalled MVC4 not from nugets but from Control Panel and then Installed Windows Azure SDK. It worked.

Happy Troubleshooting..

Number of View :774

No Comments


HTTP Error 500.21 – Internal Server Error, Solution

HTTP Error 500.21 – Internal Server Error
Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list

I received above error when I tried to include my ASP.NET application into IIS 7 and browse it. This because of the handlers missing for specific version of Microsoft Dotnet Framework in your IIS 7. I had installed visual studio 10.0 and later I installed IIS 7 So IIS did not pick up all the handlers required for running application built in ASP.NET 4.0 or .NET 3.5 framework. Every time I browse any page of the application from IIS it shows only error with index 500.21, 500.19 ..

Now here is solution you can try out,
Step 1: Check the Control Panel->Programs->Windows features on or off (This is in your WINDOWS 7  OPERATING SYSTEM)
Step 2: Ones you see list of all features in the popup check for Internet Information Services features and should have check-box enabled for ASP.NET.
Step 3: You can now try the following command on your Visual Studio command prompt,

%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i

Note: Make sure you opened the command prompt using ‘Run as Administrator’. While doing above operation you should close all instances of Visual Studio IDE, tools.

This will add all handlers in IIS 7 and try browsing the page you should get the page without error.
You should also check that your application pool is targeted to use appropriate framework version.

Happy troubleshooting..

Number of View :991

No Comments



SetPageWidth
Content Protected Using Blog Protector By: PcDrome.

Mahol Dot Org is Stephen Fry proof thanks to caching by WP Super Cache