29
Feb
Scott in: Programming
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: ASP, bug, cookies, IIS, Programming
,
1
Aug
Scott in: Programming, Windows
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.
,
12
May
Scott in: ASP.NET 2.0, Technology
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):

,
13
Apr
Scott in: Programming, Windows
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
Permanent link to this post (94 words, estimated 23 secs reading time)
,
30
Jan
Scott in: Programming
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:
- You absolutely can buy OEM versions lawfully.
- There is no difference between OEM and non-OEM versions (EXCEPT):
- It is tied to your motherboard: You cannot move it to a new computer 3 years from now or upgrade your motherboard.
- Once you open the OEM package, you can no longer return it.
Permanent link to this post (89 words, estimated 21 secs reading time)
,
28
Jan
Scott in: ASP.NET, CSS, vb.net
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.
,
19
Jul
Scott in: ASP.NET 2.0, C#, Enterprise Library, Exceptions, Programming
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.
,
25
Apr
Scott in: Community Server, Programming
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.
,
24
Mar
Scott in: Programming, SQL
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:
,