DevelopmentNow Blog
 Thursday, July 27, 2006

Scott Mitchell wrote recently about a plug & play ASP.NET error-logging framework that he and Atif Aziz wrote for an MSDN article a while back. 

The framework is called ELMAH (Error Logging Modules and Handlers) and it's free & open source. Apparently you just install the DLL & add a few lines to your web.config, and it'll start logging errors while allowing administrators to view errors online or even access an RSS feed of recent errors. I usually install a global error handler in my ASP.NET apps & use log4net to log & email the information, but I never put together a web-based error viewer. So if there's a stable framework that wraps all that up, I'm all for it.

You can download & read more about ELMAH here. Some screenshots (courtesy of MSDN):


Viewing the error log


RSS feed of recent errors

July 27, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



So I was downloading the latest version of Anthem.NET to use for a Visual Studio 2003 project. I downloaded the zip, extracted, made the virtual directory, but kept getting weird security errors like

"The project location is not fully trusted by the .NET runtime. This is usually because it is either a network share or mapped to a network share not on the local machine.  If the output path is under the project location, your code will not execute as fully trusted and you may receive unexpected security exceptions."

and Visual Studio saying I can't debug the application. When I tried going to the local site in IE (localhost/Anthem-Examples-2003) I'd get

"Server cannot access application directory 'C:\Documents and Settings\Ben\My Documents\Visual Studio Projects\anthem\Anthem-Examples-2003\'. The directory does not exist or is not accessible because of security settings."

It always worked flawlessly before. So, after some dorking and searching around, I finally got it working, here's how I did it...

  • After downloading the zip file, I right clicked it and clicked "Unblock" (some new XP SP2 security thing). Then I extracted it. That resolved the first "project location not trusted" issue.
  • I then went to Control Panel->Admin Tools->.NET 1.1. Security Wizards, and gave full trust to the Intranet Zone.
  • I then disabled simple file sharing (Control Panel->Folder Options->View tab->Uncheck simple file sharing). This allowed me to access the "Security" tab on folders.
  • I then went to the folder containing the files that I extracted from the zip file. I right-clicked the folder, went to the (newly available) Security tab, and gave the Users group (of which the ASPNET account is part) standard (read/view/execute) access to that directory.

And now it works. I think a recent Windows security update is probably to blame. But, now we're back in action.

July 27, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



I forgot to include links for some of the libraries I used in my talk at Code Camp:

Atlas -- http://atlas.asp.net

Anthem -- http://www.anthemdotnet.com

Prototype -- http://prototype.conio.net/

script.aculo.us -- http://script.aculo.us/

 

July 27, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Wednesday, July 26, 2006

I've spent a lot of time lately playing with Atlas & I'm enjoying working with it, despite the huge javascript payload. I wanted to incorporate some script.aculo.us effects into an Atlas page, and noticed this helpful post from huddletogether:



there seems to be a conflict between Scriptmanager and Scriptaculous
you need to place the Scriptaculous after the scriptmanager.
add the following lines of code to get it working:
<body>
<form id="form1" runat="server">
<atlas:ScriptManager ID="sm1" EnablePartialRendering="true" runat="Server" />
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript" src="/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="/js/lightbox.js"></script>

other html goes here
<body>


I figured there would probably be javascript conflicts (Atlas already uses prototype's $ syntax). I wonder what else happens when intrepid ASP.NET coders want some fancy effects on their pages?

July 26, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Monday, July 24, 2006
You can download the slides & code from Code Camp 2006 (Ajax and ASP.NET) here. Note the projects are for VS2005.
July 24, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Tuesday, July 18, 2006

Instead of using Notepad all the time for viewing random text files, why not check out one of the many replacements mentioned on Rick Strahl's post on Notepad replacements. FWIW I use TextPad, although their menu hotkeys take a little getting used to (F5 for Find??).

July 18, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Thursday, July 13, 2006

Up to base 36, anyhow. This is a port from old C. I think it works (did it on paper).

// return decimal version of any number up to base 36
// e.g. strtonum("110", 16) returns 272 (which is 110 in base 16)
int strtonum(orig, base)
{
    string digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int retval = 0;

    for (int i = 0; i < orig.length; i++)
    {
        string character = orig[i];

        for (j = 0; j < digits.length; j++)
        {
            if (character == digits[j])
            {
                retval = retval * base + j;
                break;
            }
        }
    }

    return retval;
}

July 13, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]



 Thursday, July 06, 2006

FYI, I'll be speaking at Portland Code Camp 2.0 this year, talking about incorporating AJAX functionality into ASP.NET applications. July 22nd & 23rd at WSU's Vancouver campus. It's free for everyone, so go ahead and get registered. Code Camp is a very informal, code-centric (as opposed to yak-centric) conference put on by developers, for developers.

I was tempted to also speak about O/R Mappers & code generators, but I think one presentation is enough this time around. :)

Edit: Code Camp is down to one day, July 22nd. Registration is free & starts at 8am.

July 6, 2006    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]