ASP.NET

Post Back from AJAX Update Panel

Recently, while working on a dev assignment I needed to make a complete post back (with page refresh) from a button control placed inside AJAX Update Panel. Exact problem was like this. There is a webpage on which I require AJAX functionality. Also, there is one button on whose click I want to make a post back. That button is also placed inside AJAX update panel and anything placed inside update panel by default does a Ajax callback. Sample web page is shown below:

image

Initially I thought of moving my Post Back Call button outside of AJAX update panel but that would have ruined my UI design. I was trying different options when I stumbled upon UpdatePanel’s child element . provides another child element with an attribute ControlID. We can specify from which control we want to make a post back call using this ControlID. Below code sample shows how to do this in ASP.NET.

image

This is quite simple to understand. Button btnPostBackCall will now make a complete call back. I recommend further reading on this topic from:

Currently Listening To: Heartbreak Warfare by John Mayer
~eNjOy~

Advertisements

IIS 7.0 – Site Vs. Application Vs. Virtual Directory

Another thing with IIS 7.0 which always bothers me is exact difference between web site , application and virtual directory. There is lot of verbose information present online related to this topic. After going through few good web links I managed to prepare a summary of the differences, that is easy to understand and remember.

[ Note: It is highly possible that you might get this information from MSDN or IIS web logs as I prepared it from there 🙂 ]

Introduction
  • A site contains one or more applications, an application contains one or more virtual directories, and a virtual directory maps to a physical directory on a computer
  • A site contains all the content, both static and dynamic, that is associated with that site.
  • Each site must contain at least one application, which is named the root application.
  • Each application (including the root application) must contain at least one virtual directory, which is named the root virtual directory. These objects work together to form the site.
  • An application can have several virtual directories, and each one will be served by the same App Domain as the application to which they belong.
Site
  • Container for applications and virtual directories, and you can access it through one or more unique bindings.
  • The binding includes two attributes important for communication: the binding protocol and the binding information (combination of IP address, port, and optional host header)
  • A site may contain more than one binding
  • In addition to containing applications (which contain virtual directories) and specifying bindings, the following configuration settings belong to the site:
        • Limits: configure settings to limit the amount of bandwidth, the number of connections, or the amount of time allowed for connections to a site.
        • Logging: configure settings for handling and storage of log files for the site.
        • Failed request trace logs: configure settings for logging failed-request traces for the site
APPLICATION
  • Group of files that delivers content or provides services over protocols
  • Application’s path becomes part of the site’s URL
  • In addition to belonging to a site, an application belongs to an application pool, which isolates the application from applications in other application pools on the server.
VIRTUAL DIRECTORY
  • Map to a physical directory on a local or remote server
  • Directory name then becomes part of the application’s URL
  • An application can have more than one virtual directory
  • For example, you might use a virtual directory when you want your application to include images from another location in the file system, but you do not want to move the image files into the physical directory that is mapped to the application’s root virtual directory.

I hope! things are much clearer now.

eNjOy cOdInG!!
Currently Listening to: John Lennon – Happy Xmas (War Is Over)

IIS 7.0 – Classic and Integrated pipeline

While creating a new app pool, users are required to choose framework version and pipeline type. I was not sure about the difference between available pipeline types. I spent some time on this topic and reading MSDN articles. this is what I understood:

Classic Pipe Line in IIS 7.0

  • Works just like IIS 6.0
  • All requests pass through the IIS pipeline first, and then if the file extension is mapped to ASP.NET ISAPI extension, then the request is handed to aspnet_isapi.dll and passes through the ASP.NET request pipeline.
  • If the file is static file, ASP or PHP, it is handled by something else.

Integrated Pipeline IIS 7.0

  • Allows http modules to participate in all requests
  • This works also for static contents, PHP pages and image
  • Provides unified request processing, regardless of handler
  • For example, managed Forms Authentication can be used for all content, including ASP pages, CGIs, and static files.

Cheers!!!

STRUTS Vs ASP.NET

I found a good white paper on MSDN related to Struts and ASP.Net architecture comparison.

http://msdn2.microsoft.com/en-us/library/aa478961.aspx

After reading, it looks like ASP.NET is better than STRUTS. But as white paper is published on MSDN, I am not sure every feature of STRUTS is covered.

Now check this out., how Java guys are fuming over this…nice fun

Currently Listening – Pyaar Ka Musafir-LUCKY ALI

Debug ASP.net apps on VISTA

There is a lot of criticism going around regarding debugging capabilities of Windows VISTA and Visual Studio 2005. A lot of guys that are using Vista Home (cheapest and all laptops comes with HOME) think that it’s only a problem with Vista Home edition and MS must have done this as a marketing gimmick. I think this is not true. Last night I was not able to debug a simple web application on my computer, that’s running Windows Vista Ultimate X86 edition. So I just googled for few seconds and solution was in front of me.

You can either go to msdn web Dev blog or check out steps and links given below. Actually all the content that you see below is just copy pasted from above link. So it will be much better if you check out the link.

The Visual Studio team has just released a down loadable hot fix, which fixes problems resulting in such errors, and also enables the ability for Visual Studio 2005 to F5 debug web applications on IIS7 in Vista Home versions.

The following steps should be done to properly configure your IIS7/Vista environment for building ASP.NET web applications using Visual Studio 2005:

  1. Install Visual Studio 2005 SP1
  2. Install Visual Studio 2005 Update for Vista
  3. Install Visual Studio 2005 hot fix for F5 authentication errors
  4. Configure required IIS7 components
  5. Run Visual Studio using the “Run As Administrator” option on the right-click menu

Currently Listening To: What Have I done-LINKIN PARK
~eNjOy LiFe~