Archives

Archives / 2009 / December
  • GDI+ Error when converting Tiff to Jpeg: Parameter is not valid

    One of the web applications that I work on is Instant Church Directory, a website that helps churches create a church photo directory.  Since the main focus of the application is to create a photo directory, customers are uploading all sorts of images into Instant Church Directory and the application needs to correctly convert and store the images and insert them in the final output, which is a PDF.

    Read more...

  • Amazon is offering free one-day shipping for the Kindle

    I love this.  Amazon is offering free one-day shipping for their Kindle starting tomorrow December 23.  This means you can buy the Kindle up until midnight (EST) on December 23, 2009 and still have it delivered in time for Christmas.  (There is free 2-day shipping if you buy it today.)  What an awesome way to bring in new customers. 

    Read more...

  • jQuery: How to check if button is disabled

    You can use jQuery to trigger a button click from the client.  In this certain situation, I needed to make sure the button was not disabled prior to clicking.  In jQuery you can use the “is” function to check if the button is disabled like this:

    Read more...

  • Amazon Same Day Shipping

    Back in October I heard that Amazon was introducing same day shipping delivery for some cities. Today I received an email for being an Amazon Prime member reminding me that Amazon has the ability to deliver an item to me within the same day.  But what is really amazing is the cut-off times; in Seattle you can order an item up to 1PM and get it delivered to you that same day:

    Read more...

  • URL Authorization role service required for IIS7 system.webServer/security/authorization

    Why isn’t IIS7 authorization working in my asp.net website?  I was trying to secure a folder in my asp.net application using the IIS7 system.webServer/security/authorization configuration settings.  In the past you could do this through the ASP.NET configuration by adding an authorization section to the system.web section in your web.config.   But now with IIS7, you can use the new system.webServer/security/authorization section to specify authorization rules.  The benefit of system.webServer authorization over system.web authorization is that the former applies for all requests to that particular location, the latter only protects asp.net requests (requests that come through the asp.net pipeline).

    So, since I am developing this application on IIS7, I wanted to use the new IIS7 system.webServer authorization section to protect a particular folder.  To do this, I added the following section to my web.config file:

    <location path="admin">
      <system.webServer>
        <security>
          <authorization>
            <remove users="*" roles="" verbs="" />
            <add accessType="Allow" users="" roles="administrators" />
          </authorization>
        </security>
      </system.webServer>
    </location>

    and tested the url http://localhost/admin and… it didn’t work.  What should have happened is I should have been redirected to the forms authentication login page, but instead I was served the content under the /admin folder.  Not what I wanted; the /admin folder should now require an authenticated user and the forms authentication identity to be part of the administrators role.

    What is going on?!?!?  Everything looked correct.  I confirmed that IIS authentication was set correctly: anonymous and forms authentication only.  I confirmed that the system.web/authorization section was working.  I tried in multiple browsers to make sure it wasn’t a cookie or a caching issue.  Still I was left scratching my head… why were settings in the IIS7 system.webServer/security/authorization not getting picked up?

    Finally, with the help of Scott Forsyth, I checked the Server Manager IIS Roles that were enabled.  Server Manager > Roles > Web Server (IIS) > Add Role Services

    image

    image

    Notice that the URL Authorization role service is not installed. 

    image

     

    That was it.  IIS7 did not have the role service installed so it was not understanding that section of the web.config file.

    After installing the IIS URL Authorization role service, a request to http://localhost/admin redirected to the forms authentication login page and required a user that was in the administrators role.



    Read more...

  • IIS7 Search Engine Optimization Toolkit does not like HTML5 Doctype

    The IIS7 Search Engine Optimization (SEO) Toolkit is an awesome tool to review your site and indicate any problems with the html that may cause search engines not to index your website properly.  Check out Scott Guthrie’s post on the IIS7 Search Engine Optimization Toolkit or you can download it from the IIS website at the tool’s home: IIS7 SEO Toolkit.

    But I ran into an issue with the tool the other day where it was not returning the proper results.  I ran it against a website I was working on and it only crawled one page and returned results that were just not correct:

    image

    The errors: “The title is missing.”, “The description is missing.”, and “The <h1> tag is missing.” were incorrect since I had all of those on the home page of the site I was testing, but also it was curious that it was not crawling any other urls off of that home page.

    AND the content tab even showed all of these things in the html that the tool had retrieved:

    image

    Eventually I was able to track it down to using the HTML5 Doctype tag:

    <!DOCTYPE html>

    The HTML5 document type is not official yet but I have gone ahead and started using as recommended by many developers but apparently the IIS7 SEO Toolkit does not like this doctype yet.  Temporarily I switched it to another doctype:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    And the SEO Toolkit worked as expected.  Just a heads up for any other developers that run into this when using HTML5 DOCTYPE.

    UPDATE (2009-12-07):

    Dave Cox added a comment about it not being the HTML5 DOCTYPE per say but the whitespace that comes before it.  Having a line of whitespace AND the HTML5 DOCTYPE causes the IIS7 SEO Toolkit not to read the content correctly.

    Bad:
    image

    Good:
    image

    I am using ASP.NET MVC in this project so that means my master page will look like this; the DOCTYPE declaration on the same line as the Master page directive:

    image



    Read more...