jump to navigation

Using client side javascript to check file inputs January 25 2005

When creating a form that has multiple file uploads consider checking the form with Javascript on the client side rather than the server side. Once a form is posted, all the files will be uploaded (whether the form is correct or not) which may cost a lot of time! This is especially true with international users posting files from over seas. Consider waiting 10 minutes to post all the files on a form just to have the app spit back an error message saying “I don’t like the length of your title”

Blah! Javascript is still alive …

Text input with symbols

Recently I created an application that required the user’s ability to enter trademark and copyright symbols into text fields. There didn’t appear to be a problem at first since the symbols seemed to be preserved after processing but upon closed inspection using the string.replace() method, strange artifacts began appearing.

To solve this problem I wrote a quick function that would replace certain characters (as identified by there CHR() values) by common HTML.

Public Shared Function formatStringToHTML(ByVal strString As String) As String
Dim strNewString As String = strString
strNewString = strNewString.Replace(Chr(174), “®”)

IIS 404 Errors for Files That Exist! January 13 2005

This is a security feature that I stumbled upon when trying to serve up .IVR files from an IIS on a Windows 2003 server box. IIS will not serve up files of unknown MIME types.

Basically the IVR is a panoramic image file which can be loaded into an applet and displayed through the web. What was happening was that the applet was loading and then stopped but not throwing any exceptions. The applet needed the .IVR file from the webserver which IIS was reluctant to serve up.

Solution: Add an application/octet stream MIME type for the IVR file …

Windows Media Player and Screen Captures January 04 2005

This is slightly odd. I tried to take a screen capture from a video playing in my Windows Media player using the usual (Ctrl+PrintScreen). The strange thing was that the capture came out with everything except the video part that I was looking for!

The simple fix was to turn down the Video Acceleration in Media Player to about half (Tools -> Options -> Performance -> Video Acceleration)

Ctrl-PrintScreen and presto!

Directory.CreateDirectory and System.IO.DirectoryNotFoundException January 03 2005

I have been having some fun trying to create directories from ASP.NET Virtual Server directories. The problem was that everytime I tried to create the directory such as:

Directory.CreateDirectory(Server.MapPath(”test_dir”))

I would receive an exception such as:

System.IO.DirectoryNotFoundException: Could not find a part of the path “D:”.

What was happening here was that the webroot was located off of the D: drive and the IIS group did not have “List” or “Read” permissions to the root of the D: drive. Once the permissions were set, I had no problem creating directories.

Hope this helps anyone out there pulling out their hair!

| older posts »