Jul 22nd, 2009 | No Comments

Another one of those problems that can stump you for a while. I often make backups of files as I progress and sometimes leave them in the website folder, this was fine with classic ASP but as I have found with ASP.Net can cause all sorts of problems.One issue I was having was trying to reference a component in my aspx page from the codebehind page and seeing the following error when trying to reference a label control:

“Label2 does not exist in the current context”

So I found that the problem was even though I renamed one of my old files it still contained the class that my codebehind was referencing (i.e. the class names were still the same) – and therefore was not seeing the newly added Label control to my new code.Shame the compiler doesn’t realise the duplication and give some indication.

Lesson: Remove any backed up files from the web folder and/or build directory to avoid pain )

Written by Ajay Matharu

July 22nd, 2009 at 11:24 pm

Jun 20th, 2009 | No Comments

Zipping was never so easy in .Net. Check out this project on codeplex, http://dotnetzip.codeplex.com/

Here are the features of the DotNetZip Library,
DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Create and read zip files in VB, C#, or any .NET language, or any scripting environment. DotNetZip supports these scenarios:
- an ASP.NET app that dynamically creates ZIP files and allows a browser to download them
- a Windows Service that periodically zips up a directory for backup and archival purposes
- a WPF program that modifyies an existing archive – renaming entries, removing entries from an archive, or adding new entries to an archive
- a Windows Forms app that creates AES-encrypted zip archives for privacy of archived content.
- An administrative script in PowerShell or VBScript that performs backup and archival.
- a WCF service that receives a zip file as an attachment, and dynamically unpacks the zip to a stream for analysis
- creating zip files from stream content, saving to a stream, extracting to a stream, reading from a stream
- creation of self-extracting archives.

Njoy coding :)

Written by Ajay Matharu

June 20th, 2009 at 1:42 pm