Jeff Widmer's Blog

ASP.NET, ASP.NET MVC, C#, VB.NET, IIS7, Windows Forms, VB6, ASP 3.0

  • Windows Server 2008 IIS7 SMTP properties

    In Windows Server 2003 IIS6 you were able to change SMTP properties from within Internet Information Services (IIS) Manager.  In Windows Server 2008 the IIS7 Manager does not handle SMTP anymore... but you can modify it by using the old IIS6 Manager which is provided as part of the Windows Server 2008 Administrative Tools.

    Under Administration Tools you will now find two different IIS Manager entries.  One for IIS7 and one for IIS6.  Choose the IIS6 Manager to change the SMTP properties.

    image

    The IIS6 Manager will only have an item for the SMTP Virtual Server.  Right-click on the SMTP Virtual Server and select properties.

    image

    This will display the familiar SMTP Properties dialog that you are used to from Windows Server 2003.  Now you will be able to change things such as the size limit of the messages, the number of messages per connection, outbound delivery delay notifications, etc.

    image

    image

  • Visual Studio paste without changing IDs in Source View

    When pasting a snippet of HTML into the Visual Studio source window, Visual Studio will automatically change the IDs to the default naming convention (TextBox1, etc.).

    image

    Most of the time though I do not want this to happen since I purposely want to have that ID copy exactly as is since it makes things easier for me when changing the name.  For example, it is easier to change FirstNameTextbox to LastNameTextbox than to change TextBox1 to LastNameTextbox.

    There is an option to turn the Auto ID elements on paste off.  It can be found in:

    Tools > Options > Text Editor > HTML> Miscellaneous > Auto ID elements on paste in Source view.  Uncheck the box to turn this feature off.

    image

    Now Visual Studio will leave my IDs alone:

    image

    Michael Campbell of SQL Server Audits pointed this out to me a couple weeks ago.

  • Friendlier Windows Update in Windows 7

    I recently upgraded my laptop to Windows 7 and got the new experience of the new Windows Update notification last night:

    image

    Very friendly, to the point, told me what was going to happen, and set my expectations correctly.  I liked it a lot.  Thank you Windows 7!

    Technorati Tags: ,
  • Unexpected error encountered opening Visual Studio project

    I recently tried to open a Visual Studio project that I had downloaded from Codeplex and received an error message:

    image

    Followed by this error message:

    image

    And then the Visual Studio project was not available in the solution.  All the project said was “The project file cannot be loaded.”  Not a very helpful error message.

    This is because the project was under Team Foundation Server (TFS) source control and I do not have the TFS edition of Visual Studio.  To resolve this issue open the project files in notepad and remove the source control provider lines.  Usually they look like this:

    <SccProjectName>XXXX</SccProjectName>
    <SccLocalPath>.</SccLocalPath>
    <SccAuxPath>XXXXXX</SccAuxPath>
    <SccProvider>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</SccProvider>

    Remove all 4 of these lines from the project file and then save it and reopen.  Now Visual Studio will not try to load TFS and you will not get the error message and the project will open correctly.

    -Jeff

     

    FULL ERROR MESSAGE TEXT:

    ---------------------------

    Microsoft Visual Studio

    ---------------------------

    Unexpected error encountered. It is recommended that you restart the application as soon as possible.

    Error: Unspecified error

    File: vsee\lib\vapifunctionwrapper\vapifunctionwrapper.cpp

    Line number: 169

    ---------------------------

    OK Cancel

    ---------------------------

     

     

    ---------------------------

    Microsoft Visual Studio

    ---------------------------

    One or more projects in the solution could not be loaded for the following reason(s):

    The application for the project is not installed.

    These projects will be labeled as unavailable in Solution Explorer. Expand the project node to show the reason the project could not be loaded.

    ---------------------------

    OK Help

    ---------------------------

     

     

  • Machine Setup: Add Notepad to Send To Menu

    I always customize my Send To menu to include Notepad.  Having notepad in the SendTo menu allows me to easily open any file and just view the contents in notepad.  Comes in handy when you do not want to load an application just to grab a config setting. 

    image

    In Windows Vista (and Windows Server 2008) the Send To menu can be edited by modifying the contents of the SendTo folder which can be found here:

    C:\Users\[USERNAME]\AppData\Roaming\Microsoft\Windows\SendTo

    Just drop a shortcut in there to notepad:

    image

    Now whenever you right-click on a file and choose Send To you will have the option of selecting Notepad.

    -Jeff

    Technorati Tags: ,,
  • Why does Visual Studio not resolve my CSS class names?

    Whenever I was working in Visual Studio I always found that it would not resolve the css class names in my html.   The CSS Class names would appear with the green squiggly line in Visual Studio but then the page would render fine when viewing it in the browser.  

    image

    Also the Design View would never show any of the css styles.  But I have been working with Visual Studio since the very early days and rarely used Design View and since the CSS styles were not rendering it was just another reason not to use Design View. 

    I always thought it was just the way Visual Studio worked. 

    But recently I was trying to get intellisense to work with jQuery and I read this article by Jeff King: JScript IntelliSense FAQ

    In particular I read point #4, third bullet:

    Site-Relative Paths - These are paths of the form "/folder/file", and is calculated from the base of your site (http://site/application/folder/file).  This approach is supported by ASP.NET Web Forms and ASP.NET MVC.  However, it is not supported by Visual Studio.  The reason is because Visual Studio does not always know the final deployed location of your site and thus the path resolution cannot be guaranteed.  Given that quite we've seen few folks are using site-relative paths, we could consider making an assumption just resolving this type of path to the root of the project.  Given the risk that you may think your site is working when it's really not, I wanted to see how many people were supportive of this.

    Notice the “[Site-Relative Paths are] NOT supported by Visual Studio”.  So this was the solution to why I was not getting intellisense in my javascript.  I always use site relative paths for my javascript files so I need to add this line in to get Visual Studio to find my javascript file:

        <script src="/content/jquery-1.3.2.min.js" type="text/javascript"></script>
        <% if (false) {%>
            <script src="../../content/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
        <% } %>

    So now with the “<% if (false) {%> ” Visual Studio will be able to find the javascript file which contains the intellisense information.

    So now I have intellisense showing up in Visual Studio for javascript which is very nice but is not the point of this article.  What I realized is that Visual Studio cannot find any files in to a Site-Relative Path which includes CSS files.  So my CSS file which is referenced like this:

    <link href="/content/default.css" rel="stylesheet" type="text/css" />

    is not getting found by Visual Studio which now completely explains why I am getting the green squiggly lines in HTML view and why the Design View does not render as expected.  Applying the same fix in for Javascript intellisense to my CSS references:

        <link href="/content/default.css" rel="stylesheet" type="text/css" />
        <% if (false) {%>
            <link href="../../content/default.css" rel="stylesheet" type="text/css" />
        <% } %>

    And now Visual Studio can find the CSS file and validate my CSS Class names exist (and Design View looks so much better too… I might start using it :) ): 

    image

     

    Stack Overflow Question: Why does Visual Studio not resolve my CSS class names?

     

    Technorati Tags: ,,

  • Machine Setup: SourceGear DiffMerge

    Another tool I always have on my development machine in SourceGear’s free DiffMerge tool (http://sourcegear.com/diffmerge/)

    Not only is this the diff/merge tool from Visual Studio or SourceGear Vault but it also adds some very nice and useful context menus to Windows Explorer for being able to quickly compare two files (or folders):

    SourceGear DiffMerge Context Menu

    This comes in very handy and since it has a great price (free!) it is one of the tools that gets added to my machine at the beginning.

    -Jeff

  • Machine Setup: OneNote Sort Pages Powertoy

    I use Microsoft OneNote a lot for notes, tasks, projects, reference, etc.  One of the addins that I recommend for OneNote is Daniel Escapa’s Sort Pages powertoy

    Just run the setup application that you can get from his blog, close and reopen OneNote, and you will end up with a new button in OneNote:

    image

    Clicking this will alphabetically sort the page in the current notebook.  (NOTE: As Daniel mentions in his blog there is no undo and no confirmation, so be careful when hitting this button.)

    -Jeff

    EDIT (2011-01-25): There is now a OneNote 2010 version: http://weblogs.asp.net/jeffwids/archive/2011/01/25/machine-setup-onenote-2010-sort-pages-powertoy.aspx

    Technorati Tags:
  • Mindjet MindManager stops mouse from working

    I recently upgraded my development machine to not only a new computer but also Windows Server 2008.  I also chose to go with Windows Server 2008 64-bit to take advantage of the 8GB RAM that my new computer can handle. 

    The upgrade went very smoothly but over the weekend I discovered that one of my tools, MindManager 8, caused issues on my computer.  Installation of MindManager was no problem and activation with my license key also was successful but when MindManager went to open the first tutorial MindMap, my mouse stopped working.  I tried several different things to get my mouse functionality to work including closing MindManager and installing an updated mouse driver but nothing worked.  Whenever MindManager would open a MindMap the mouse would freeze and never come back.

    Today I was able to find a work around.  Apparently this issue has to do with Tablet PC Input Service. Not exactly sure why but stopping and restarting the service will free up your mouse. Unfortunately you need to do this with each MindMap that you open.

    • Open MindMap
    • Mouse becomes frozen
    • Stop/Start Tablet PC Input Service
    • Mouse now works again

    You can also use these commands from a command prompt window instead of the Services mmc (which really helps when your mouse is not working :D ).

    net stop "tablet pc input service"
    net start "tablet pc input service"

    UPDATE (2009-05-18): Having the Hyper-V feature enabled causes this work-around not to work.  I had enabled Hyper-V and then my mouse became frozen again after opening a MindMap and stopping and starting the Tablet PC Input Service did not free up my mouse.  Not sure why and I did not look into what was going on but just turned off the Hyper-V feature and my work-around above works again.

    UPDATE (2009-05-22): I have found that I do not need to stop and start the Tablet PC Input Service after opening each MindMap but only at first.  Right now my work-around at the beginning of each day is (yes, I shut my computer down each night :) ):

    • Open MindManager (which opens the startup mind map)
    • Mouse becomes frozen
    • Stop/Start Tablet PC Input Service
    • Mouse now works again
    • Open MindMap from MindJet Connect Workspace
    • Mouse becomes frozen
    • Stop/Start Tablet PC Input Service
    • Mouse now work again (and opening any other MindMaps will not cause my mouse to freeze)

    Technorati Tags: ,,

    -Jeff

  • Bringing TallComponents TallPDF, Microsoft ASP.NET Ajax, Amazon S3, and several other technologies together into Instant Church Directory Online

    We recently finished developing and releasing the online version of our Church Photo Directory Software, Instant Church Directory. The idea behind Instant Chclip_image001urch Directory Online is to provide a user interface where you can easily create and update a PDF photo directory for all of your church members. We also took it one step further and include hosting the PDF for you.

    Instant Church Directory came together very nicely over the past 4 months and everyone at Communication Resources did an awesome job designing and building the ASP.NET application. I am always interested in how an application of this scale is put together, so below are some of the technologies that power Instant Church Directory Online:

    Amazon Simple Storage Service (Amazon S3) - http://aws.amazon.com/s3/
    One of the technical design challenges that we knew we had to overcome was hosting and distribution of the church directory PDFs. We could have stored the PDF on our own servers but the costs for storage and bandwidth quickly would have gone out of control. With Amazon S3 we get pretty cheap hosting rates and the additional scalability and reliability features that Amazon uses to power its own websites. It was pretty easy to integrate Amazon S3 into our application and we used this Amazon S3 C# library by Affirma Consulting to help us out.

    TallComponents TallPdf - http://www.tallcomponents.comclip_image002
    Instant Church Directory on CD (the WinForms version of the product) also used TallComponents TallPDF component to generate the church directory PDF file and we took that technology and ported it to our online church directory engine. One of the great features of TallPDF is the ability to stream the PDF to a file through events (pull generation). This is necessary because with all of the pictures that will get included in each church directory PDF document, we could not store the entire PDF file in memory while creating it. So we use the event driven generation method to write each page of the PDF directory to a file as we are creating it. This gets it out of memory and into a file.

    One other thing about TallComponents is their great customer support and fast response times. Asking a question or needing technical help gets a fast response from their ticketing system but also if you find a bug, it will get included in a new build within a couple of weeks. I also love the way they expose all of the feature changes for each version.

    SWFUpload - http://www.swfupload.org

    We wanted the Flickr image upload experience and so we used this SWFUpload component to give us that look and feel. SWFUpload creates a small Flash movie that is used to post one or more images to our website. The capabilities of the Flash movie along with some JavaScript gives us the progress information that we wanted our customers to see as they upload one or more image files. image


    Javascript Image Cropper from http://www.defusion.org.uk/clip_image004
    One of the technical challenges we ran into while designing Instant Church Directory was giving the user the ability to crop the image. We looked into several different technologies and models and in the end the best was the JavaScript cropper developed by Defusion.org.uk. This gave us a very responsive image cropper without a large component download.

    http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous/

    CruiseControl.Net for automatic builds - http://ccnet.thoughtworks.com/
    This is our first application to fully use an automated build and deployment system and we were thrilled with how this all worked and how much it sped up our deployment process. Hats off to Nimble Software Professionals for setting this up for us and getting us going with automated build and deployment.

    Microsoft ASP.NET Ajax - http://www.asp.net/ajax
    Many of our pages in the Instant Church Directory Online application are Ajax powered and we used Microsoft ASP.NET Ajax to build those pages. We wanted the same smooth transition when switching between individual list items that we had in our WinForms application and the ASP.NET Ajax UpdatePanel control gave us this ability quickly out of the box. I am not an expert with JavaScript so the UpdatePanel is an excellent control to easily get Ajax benefits into your ASP.NET web application.

    aspNetPOP3 by Advanced Intellect - http://www.advancedintellect.com/product.aspx?pop3
    We use the aspNetPOP3 component from Advanced Intellect to POP all of our customer service emails from our Instant Church Directory Mailbox. I highly recommend this component if you need to pull email from a mailbox through POP3 protocol. Also Advanced Intellect has great customer service if you ever have a question or need some development/technical help.

    Orcsweb - http://www.orcsweb.comclip_image005
    We have our servers hosted at Orcsweb and I can't say enough about the service and support of the entire Orcsweb team. Rick Barber, Steve Schofield, Jennifer Kurrus, Fredrick Cumbee, Desirée Harris, James Kehr, Pamela Dean, Jeff Graves, and Scott Forsyth (and others that I just don't see) all do an amazing job supporting us and keeping our servers up and running.

    Camtasia Studio by TechSmith - http://www.techsmith.com/camtasia.asp
    We used Camtasia to record all of our tutorial videos for showing how to use Instant Church Directory Online. Camtasia is an excellent screen recorder that is very easy to use to quickly produce a video. You can check out the tutorials that we created with it here:

    Instant Church Directory Online Tutorials and Demos

    I would love to hear any comments anyone has on the application - there is a 30-day free trial but unfortunately we do not have a demo account available to share.  Or post any comments/questions on any of the technologies above.

    -Jeff
    Chief Architect
    Communication Resources