Content

Programming Category

Nasty IIS/ASP Querystring Cookie Case Bug

29 Feb

+ 1

I just stumbled on a nasty, nasty ASP bug that took about 7 years for me to see.

The problem happens when using cookies and querystrings with the same name. A page on the site reads in a variable from the querystring and sets a cookie with the same name to its value, e.g.:

strSrc = Request.QueryString(”A”)
Response.Cookies(”A”) = strSource
Response.Cookies(”A”).Expires = Now + (2 * 30)

However, if the variable name in the query string is different from the capitalization of the cookie name (e.g page.asp?a=xxx) then a new cookie gets set with the name matching the captialization of the
QueryString variable.

Tags: , , , ,

  Leave Comment, 1 Comment

0.0.0.0 Gateway Causing No Internet Access

1 Aug

+ 0

Sometime last week, I stopped being able to get access to the internet while at work.  I could get an IP address from DHCP, but couldn’t get any traffic past our firewall/gateway.

I thought it was DHCP server, and was ready to buy a new one as it is 5 years old.  But then I noticed in my ipconfig /all that I had two gateways:  0.0.0.0, and then on the second line, my correct gateway, 192.168.1.1.  I had never seen two gateways listed, and almost scanned right over it.

  Leave Comment, 0 Comments

Myspace Statistics

12 May

+ 0

I am watching a programming presentation from the Myspace tech team right now. They are going over their stats and was blown away by the numbers (as of April 2007):

Myspace

  Leave Comment, 0 Comments

Delete Files Older Than Date Using Batch Files

13 Apr

+ 0

This problem has nagged at me for years.  Here is a batch command to delete files on a Windows 2003 machine.

Forfiles -p c:\backup -s -m *.* -d -5 -c "cmd /c del /q @path"

This will delete all files in my backup directory older than 5 days. To test it first, use this:

Forfiles -p c:\backup -s -m *.* -d -5 -c "Cmd /C Echo 0x22@Path\@File0x22"

This will print out each file that you will be deleting.

Now playing: Lamb Of God - Terror And Hubris In The House Of Frank Pollard

  Leave Comment, 0 Comments

Walmart Video Downloads in Firefox

7 Feb

+ 0

uhhh…where do I login?

Walmart

  Leave Comment, 0 Comments

Finally, The Truth on OEM Software

30 Jan

+ 0

I just read a great article on OEM software, called Buying OEM versions of Windows Vista: the facts.  I am sure the data here could be extrapolated to any OEM software.

The basics with OEM versions of Vista are:

  1. You absolutely can buy OEM versions lawfully.
  2. There is no difference between OEM and non-OEM versions (EXCEPT):
  3. It is tied to your motherboard: You cannot move it to a new computer 3 years from now or upgrade your motherboard.
  4. Once you open the OEM package, you can no longer return it.

  Leave Comment, 0 Comments

Render RadioButtonList as an Unordered List UL

28 Jan

+ 0

In my latest project, I found the need to use the RadioButtonList which spits out the absolute nastiest HTML to render it unusable (for me anyway). The control gives you to HTML options using the RepeatLayout attribute.

Flow spits out a series of span’s and label’s with BR’s if you don’t specify RepeatDirection of Horizontal. And choosing Table gives you a nicely unaccessible table you can’t format easily. Because of these limitation’s, I have always stayed away from CheckBoxList and RadioButtonList controls.

  Leave Comment, 0 Comments

Add Additional Information to Your Exceptions

19 Jul

+ 0

When Enterprise Library was called Microsoft Application Blocks, if you wanted to log an Exception, you would write (assuming “ex” is an Exception):

ExceptionManager.Publish(ex)

And if you wanted to log some extended properties you could do something like this:

NameValueCollection customerInfo = new NameValueCollection();
customerInfo.Add("name","scott");
customerInfo.Add("email","blah@blah.com");
ExceptionManager.Publish(ex,customerInfo);

Now that I am upgrading all legacy code to Enterprise Library 2006 for .NET 2.0, I couldn’t find a way to do this since the only way to log an error is:

ExceptionPolicy.HandleException(ex, "General Policy");

where “General Policy” is the name of the Exception Policy in the config file telling the Block what to do with the exception.

  Leave Comment, 0 Comments

Community Server Upgrade Hell

25 Apr

+ 0

This last week I was tasked with upgrading a Community Server 1.1 install to 2.0.  I was expecting a simple process after navigating the seas of .Text to CS 2.0, but I forgot to “knock on wood”.

I ran the upgrade script as indicated in the upgrade instructions and got about 15 separate errors.  I don’t remember what they all were, but there was about three missing fields in various tables that I had to add before the script would complete successfully.

Once that was done, I copied the new web files over the old ones, and tried browsing to ye’ ol’ default.aspx which resulted in a Yellow Page of Death.

  Leave Comment, 0 Comments

Find and Delete Duplicates in SQL

24 Mar

+ 0

We all know we shouldn’t have duplicates in the database. And despite my best efforts, somehow they sneak in from some legacy code, or from the hyper-active-compulsory-submit-the-form-fifty-times-in-five-seconds-bloke.

So now and then I find myself writing the same SQL to track them down. Most solutions online say that you have to use a temporary table or rename tables to get rid of them. This solution works without either, providing my way of eliminating the duplicates is sufficient for your needs.

Here is my code to find duplicates:

  Leave Comment, 0 Comments