Archive for the ‘ASP.NET’ Category

How to access Session from an IHttpHandler

I’ve gotten a lot of use during my time coding with ASP.NET out of inheriting from IHttpHandler. I usually do this to handle dynamically-generated files in various formats (PDF, XLSX, and images to name a few). One thing that always irked me was the inability to access the HttpContext’s SessionState object to get things like connection strings and information about the logged-in user more easily to aid in generating my files; often I would end up encrypting those and cramming them into the query-string, which can present challenges such as replay attacks that I’d then have to find a way to prevent.

CashTrackerOnline.com Weekly Development Summary

This will be the first of a series of weekly updates about the Cash Tracker Online project.

CashTrackerOnline.com Domain Purchased

I’ve decided to go ahead with the online version of Cash Tracker. I purchased and parked the domain on my personal hosting account today. You can view the “coming soon” splash page here. I’ve also decided to convert Cash Tracker to a web project before implementing any of the new features. I think the development will be much faster-paced because programming for the web is my strong suit. Also, the tool will be much more accessible on the web, and version control will be much easier to implement (no more converting .tfx files to a new version because of a schema change).

Connection Timeout Using LINQ DataContext

For a while now, I’ve had a website that was sporadically encountering the following error:

IHttpHandler and IRequiresSessionState

If your web application relies on session to persist the user’s state and you’ve ever tried writing your own HTTP handler, you’ve probably run into an error: “Session state is not available in this context”. Thankfully, there is a simple remedy.

ASP.NET Maintenance Scheduling Made Easy

Any time I have code I need to release for an ASP.NET website that I know is going to cause a recompile (like anything in app_code, any new binaries, master pages, user controls, etc.) I try to avoid doing it when I know there are a lot of users on the site. The best way to ensure that nobody will be using your website is to add scheduled maintenance support to your site. It’s very easy to do and it can save you and your users a lot of headache while you make updates.