Tuesday, 21 December 2010

Server.MapPath when HttpContext is null

I've been writing some code that is fired from a scheduled task and need to access the root of a website. The usual method of Server.MapPath() returns an error as the HttpContext is null due to running under another thread.
To work around this problem you can use the method:

Monday, 20 December 2010

Images showing in Firefox but not IE

I've worked on a site recently when images would show up in Firefox but not IE. This is an issue with IE not being able to show images that have the colour mode set to CMYK.

To solve, change all the image colour modes to RGB.

  1. Open the image in Photoshop
  2. Select the Image menu
  3. Select the Mode menu
  4. Select the mode you want
  5. Save image

Wednesday, 1 December 2010

Run program as Administrator from search box

If you type in the search box, you can find and run an application you are after, example notepad. If you click enter once the application is highlighted, this will run the application as a normal user.

To get the program to open as an administrator user, use the following short cut:

Ctrl + Shift + Enter