January 2011 Entries

Base Pages and Interfaces for ASP.NET Pages

For quite a while I have been using the concept of base pages when developing pages in ASP.NET applications. It is a wonderful method for exposing common functions to all of your applications pages and also overriding certain events for various purposes (i.e. dynamic themes). Recently I found out a new developer will be joining my team. This prompted me to review the applications code for readability and ease of maintenance. I began adding comments through out the code behind for all pages within ......

Use of Design vs. Source View in Visual Studio

Just a quick post back to a forum post I started regarding this topic: ASP.NET Forum Post ......

Reinitializing JQuery effects after Ajax postbacks

jQuery effects not working after UpdatePanel Asynchronous request is over ......

So long wizards!

In an effort to make an application more robust I have been switching to a server-side method of tracking record selections vs. client side. The pages relying on record selections utilized the ASP.NET Wizard control which seemed like a good idea originally. Unfortunately, the design of the control is not all that flexible. It appears to want to center everything vertically which might not be a problem if it did not always use the vertical size of the largest Wizard Step for positioning. So, I am ......

Deleting ASP.NET application subdirectories causes application recycle!

This may not be news to most people, but was definitely a shock to me! In the .NET 2.x framework a "feature" was implemented where by an ASP.NET application is automatically recycled if any subdirectory is deleted. This was apparently implemented to prevent stale content from appearing on a site. The unfortunate side effect of this "feature" is that when using the "InProc" model for session management, all session data is lost if a subdirectory is deleted. For those who progammatically may be adding/deleting ......

My First Post with Windows Live Writer

I receive daily newsletters from DotNetSlackers regarding various .NET topics. Today I read an article from an apparent Microsoft employee who gave some insight to the organizational culture within the company. Always on the lookout for new tools and technologies I noted that he used Windows Live Writer for editing and managing his blog content. I thought I’d give it a try. Let’s try adding a picture and adjusting it’s placement within this blog post relative to this text. … Adding the image is quite ......

ASP.NET Session Management

Great article (a little old but still relevant) about the inner workings of session management in ASP.NET: Underpinnings of the Session State Management Implementation in ASP.NET. Using StateServer and BinaryFormatter serialization caused me quite the headache over the last few days. Curiously, it appears the w3wp.exe process actually consumes more memory when utilizing StateServer and storing somewhat large and complex data types in session. Users began experiencing Out Of Memory exceptions in the ......

Internet Explorer will not open Office files

An issue was brought to my attention today at work where certain users were unable to open Office files (specifically Excel) from Internet Explorer 7. The user would click on a button which simply generated an inline JS call to open a pop-up pointing to the .xlsx file on the server. IE would open the pop-up and then shortly thereafter the pop-up would disappear without the file ever opening. I tweaked the security settings in the users browser...added the site to the list of trusted sites and lowered ......

Google Bot trying to access my web app's sitemap

Interesting find today... I was perusing the event log on our web server today for any unexpected ASP.NET exceptions/errors. Found the following: Exception information: Exception type: HttpException Exception message: Path '/builder/builder.sitemap' is forbidden. Request information: Request URL: https://www.bondwave.com:44... Request path: /builder/builder.sitemap User host address: 66.249.71.247 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK ......

Unexpected issues with SessionPageStatePersiste

Several iterations ago I implemented the SessionPageStatePersister in an application as a way to cut down on the size of the hidden ViewState input on aspx pages. At first it seemed utterly fantasic. The size of the ViewState appeared to be drastically reduced and the application did not appear to peform any slower than baseline. Enter the iFrame & user control. I added a user control which pings the web server every 20 seconds in order to show updated application information to the user ......

Inline code within HEAD section of ASP Web Form

Today I needed to include inline code within the HEAD section of an Web Form in order to dynamically include stylesheets based on the theme set for the application. Below is an example: <link href="../../Resources/Theme... = Page.Theme %>Grid.Default.css" rel="stylesheet" type="text/css"> Upon saving and viewing the page I noted that the code was not being interpreted and instead was being treated as a string literal. How to get around it? Add a panel control in the HEAD section and ......

Hidden inputs not always completely hidden in Internet Explorer

While working on an ASP.NET application today I noticed that after asynchronous ajax requests my page would have gap where when the page initially loaded it did not. I checked the pages source and noted that a hidden input field was declared precisely where the gap was occuring. I moved the hidden input field to the end of the pages source and the gap went away permanently. Curious ......

Using ASP.NET Membership Provider with an ACL

Up until recently one of my applications has used the membership provider within ASP.NET exclusively. However, it has been proposed that while the currently defined roles are beneficial, security needs to be more granular to restrict both access to certain pages and functionality present within a given page. Unfortunately, the role based security ASP.NET gives you out of the box falls down in this area. This is not due to a lack of foresight by Microsoft, but rather it was simply not designed for ......

Why is my query soooooo slow?

A stored procedure used in our production environment recently became so slow it cause the calling web service to begin timing out. When running the stored procedure in Query Analyzer it took nearly 3 minutes to complete. The stored procedure itself does little more than create a small bit of dynamic SQL which calls a view with a where clause at the end. At first the thought was that the query used within the view needed to be optimized. The query is quite long and therefore easy to jump to this ......

Unintentional run-in with C# thread concurrency

For the first time today we began conducting load testing on a ASP.NET application already in production. Obviously you would normally want to load test prior to releasing to a production environment, but that isn't the point here. We ran a test which simulated 5 users hitting the application doing the same actions simultaneously. The first few pages visited seemed fine and then things just hung for a while before the test failed. While the test was running I was viewing the performance counters ......