in

Platinum Bay

Peace, Love, and...

This Blog

Syndication


.NETicated

July 2007 - Posts

  • Refocusing

    Recently, I have been posting about all sorts of things; Community Server, random stuff, oh, and Community Server.

    That's all about to change.

    I was chatting recently with a friend whom I respect a lot, and we got to talking about my blog. Yes, one of the two people who actually read it <g>. He mentioned that I don't really seem to have a focus here, and I should consider finding a theme and stick with it.

    I got to thinking that my real passion, apart from .NET itself, is Enterprise development. Stuff like architecture, patterns, process (agile, iterative), middleware, BIG data, PASSMADE, reusability and code generation, XML, etc.

    So that's what I'm going to start posting about. Sure, there'll still be some random posts about Philly.NET and development related stuff. But hopefully I can provide some meaningful and beneficial dialog within the enterprise development world.

    This also means that the series on creating a Community Server Calendar extension is cancelled. First, because it doesn't directly relate to the focus, and second because the project has grown so large that I don't have enough time to write about all of it. The library itself crosses numerous architecture boundaries within CS, and is currently a little more than 12,950 loc. And that doesn't include the custom styles, URLs, resources, config settings, control panel pages, etc. that live in the Web site itself.

    So there you are. Maybe I'll find another two readers?

    See you in the Enterprise world.

    Posted Jul 26 2007, 02:46 AM by Steve with no comments
    Filed under:
  • Hacking Community Server: Event Calendars Part 1

    This is the first of a five-part series on implementing an event calendar in Community Server 2007. Our first step today will be to implement dynamic URLs, and the page stubs to go with them.

    Your first instinct might be to dive right in to the SiteUrls.config file, and start adding content. While you can certainly do this, Community Server provides support another file for just such a purpose: SiteUrls_Override.config. The benefit of using this file lies in encapsulation and separation. If and when an upgrade comes along that modifies the SiteUrls.config file, you won't have to scramble to save your changes. You also won't have to dig through hundreds of default URL configurations to find your stuff.

    Go ahead and create a file called SiteUrls_Override.config in your root Community Server directory. For our purpose, the contents look like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <
    Overrides>
        <
    Override xpath="/SiteUrls/locations" mode="add">
            <
    location name="events" path="/events/" themeDir="events">
                <
    url name="eventhome" path="" pattern="default.aspx" physicalPath="##eventthemeDir##" vanity="{2}" page="eventlist.aspx" />
                <url name="eventapplication" path="default.aspx" pattern="default.aspx" physicalPath="##eventthemeDir##" vanity="{2}?App=${{app}}" page="eventlist.aspx" />
                <url name="eventday" path="archive/{1}/{2}/{3}.aspx" pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})\.aspx" physicalPath="##eventthemeDir##" vanity="{2}?y=$1&amp;m=$2&amp;d=$3" page="eventlist.aspx" />
                <url name="eventmonth" path="archive/{1}/{2}.aspx" pattern="archive/(\d{4})/(\d{1,2})\.aspx" physicalPath="##eventthemeDir##" vanity="{2}?y=$1&amp;m=$2&amp;d=1" page="eventlist.aspx" />
                <url name="eventId" path="archive/{1}/{2}/{3}/{4}.aspx" pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})/(\d+)\.aspx" physicalPath="##eventthemeDir##" vanity="{2}?y=$1&amp;m=$2&amp;d=$3&amp;EventID=$4" page="event.aspx" />
                <url name="eventName" path="archive/{1}/{2}/{3}/{4}.aspx" pattern="archive/(\d{4})/(\d{1,2})/(\d{1,2})/([a-zA-Z0-9\-\._]*?)\.aspx" physicalPath="##eventthemeDir##" vanity="{2}?y=$1&amp;m=$2&amp;d=$3&amp;EventName=$4" page="event.aspx" />
                <url name="eventcategory" path="archive/category/{1}.aspx" pattern="archive/category/(\d+)\.aspx" physicalPath="##eventthemeDir##" vanity="{2}?CT=Event&amp;CategoryID=$1" page="eventlist.aspx" />
                <url name="eventalltags" path="archive/tags/default.aspx" pattern="archive/tags/default.aspx" physicalPath="##eventthemeDir##" vanity="{2}" page="eventtaglist.aspx"/>
                <url name="eventtags" path="archive/tags/{1}/default.aspx" pattern="archive/tags/(.*?)/default.aspx" physicalPath="##eventthemeDir##" vanity="{2}?Tags=$1" page="eventlist.aspx"/>
            </
    location>
        </
    Override>
        <
    Override xpath="/SiteUrls/transformers" mode="add" where="after">
            <
    add key = "##eventthemeDir##" value = "/themes/{0}/{1}/" />
            <
    add key = "##eventdirectory##" value = "{0}/" />
        </
    Override>
        <
    Override xpath="/SiteUrls/navigation" mode="update">
            <
    navigation>
                <link name="home" resourceUrl="home" resourceName="home" roles="Everyone" />
                <link name="blog" resourceUrl="webloghome" resourceName="weblogs" roles="Everyone" applicationType = "Weblog" />
                <link name="events" navigateUrl="/events/" resourceName="events" roles="Everyone" />
                <link name="forums" resourceUrl="forumshome" resourceName="forums" roles="Everyone" applicationType = "Forum" />
                <link name="gallery" resourceUrl="galleryhome" resourceName="photos" roles="Everyone" applicationType = "Gallery" />
                <link name="files" resourceUrl="fileshome" resourceName="files" roles="Everyone" applicationType = "FileGallery" />
                <link name="controlpanel" resourceUrl="controlpanel" resourceName="controlpanel" roles="SystemAdministrator,BlogAdministrator,ForumsAdministrator,Moderator,GalleryAdministrator,FileAdministrator,ReaderAdministrator,MembershipAdministrator" />
            </
    navigation>
        </
    Override>
    </
    Overrides>

    Don't worry; it's not really as bad as it looks. Inside of the Overrides root tag are two Override tags. The Override tag tells Community Server which section of the SiteUrls.config you are overriding. The override tag has two main attributes; xpath and mode. The xpath attribute defines which section of the SiteUrls.config file you are overriding. The mode specifies how you are overriding that section, and has three options: add, update, and change. For the add value, you can specify an additional attribute: where.

    <Override xpath="" mode="[add|update|change]" where="[start|end]">
    </Override>

    The URL has a number of attributes that need to be specified.

    • name -- the name of the URL which can be used as the UrlName on the <CSControl:SiteUrl /> control to generate links to this new URL.
    • path -- the path is used to format the URL through controls such as <CSControl:SiteUrl />
    • pattern -- when matching a request, the pattern (which supports RegEx syntax) is used to detect if the requested URL matches the <url />
    • physicalPath -- because this is a themed page, physicalPath should be set to "##themeDir##"
    • vanity -- vanity defines the reformatting of the requested URL (which can use RegEx matches from the pattern attribute) to the local URL. For themed pages, {2} will identify the page within the <location />s themeDir.
    • page -- page represents the name of the ASPX file within the <location />s themeDir in the current theme that implements the UI of this <url />

    One exception to the above attributes is that in this case I am using ##eventthemeDir## because we are using a custom theme directory. This takes place in the transformers override.

    In the first group, I am adding a new location tag, and adding URLs to that location. URLs include tags, categories, and separation by date, just like blog posts. In the second group I am rebuilding (updating) the navigation bar that lives right below the header. Though it seems like duplication, you need to use mode="update", and re-include each item that you want in the navigation in order to be able to place your new item where you want.

    And voila, you now have a new menu item in your menu bar.

    But don't get too excited, we're not done yet. If you were to attempt to navigate to your /events/ folder, the request would most likely fail. This is because when IIS receives the request for the folder, it sees that the folder doesn't exist and throws a 404 error, rather than passing it on to the ASP.NET runtime. In order to fix that situation, we need to create the /events/ folder, and add an empty Default.aspx file to it. Well, not quite empty, you need to add an empty Page declaration. I added a comment line as well for maintainability.

    <%@ Page %>

    <%
    -- Placeholder for URL rewriting--%>

    Yup, that's it. The reason for this is to make sure any requests for this directory get passed to the ASP.NET runtime (aspnet_wp.dll).

    So we're almost there, but there is still one more thing to do. In order to accommodate our new event location URLs, we need to create the event theme directory and the page stubs. For now, create a directory named Events in your Themes/[theme] directory. Next, create three normal ASPX files called eventlist.aspx, eventtaglist.aspx, and event.aspx. What I did was to add a little content to the page to identify each one, and write out the querystring value.

    event content here
    <p>
    <%= Server.UrlDecode(Request.Url.Query) %>
    </p>

    Now you can go ahead and test out your URL rewriting, and check the results on the resulting pages.

    Here are some URLs to try:

    • /events/archive/category/mycategory.aspx
    • /events/archive/2007/06/01.aspx
    • /events/archive/2007/06.aspx
    • /events/archive/tags/default.aspx
    • /events/archive/tags/mytag/default.aspx

    Stay tuned for Part 2 of this series, where we will explore creating a Community Server data and application provider for our calendar event system; the business and data layers of our event calendar.

  • Visual Studio 2005 Error Reporting Experience

    Visual Studio 2005 is a great tool, a great IDE. It is generally very stable. But when it crashes, it crashes hard. I certainly want to do my part to make the product better, and lately I have been patiently waiting for the Error Reporting module to upload crash reports to Microsoft. But sometimes they seem to take forever to upload. The real frustration is that I don't know just how much time it will take. See, the Error Reporting window gives me an estimated transfer time based on a 56k modem. Personally, I only know of one developer who still uses a 56k modem to connect to the Internet. It may seem trivial, but how hard would it have been to detect my connection speed and show a more accurate estimated transfer time? Oh, and if it's still transferring, why does it tell me it's checking for the status of the problem? It's the little usability things that make a huge difference in a user's perceived product experience.

    Just to mention, only once in using Microsoft products has error reporting ever come back to me with a solution for an error. How about saying that "we got your error report", "we have seen this problem before" (most likely), "it's related to XYZ", and "we are working on it". Then we could have that warm fuzzy feeling that Microsoft values our feedback, and us.

    Oh, and in the time it took me to write this up, here's the progress it's made.

    Doh! Good thing I'm not working on a deadline.

  • Community Server Time Zones

    I have noticed recently that when I post a new item, the post times are 3 hours behind. I finally decided to check this out, and browsed to Control Panel >> Administration >> Settings >> Date / Time Settings.

    When I had gone through the settings after upgrading the server, I saw this box for Time Zone. I live in West Chester, PA, which is in the Eastern US time zone, so that's what I selected.

    Tonight upon further inspection, the little help tag said it should be set to the time zone that the database server resides in.

    Fortunately, Community Server appears to process dates according to UTC, and this change filtered out to all of the posts, which now display the correct times.

    Doh!

  • Hacking Community Server: Comments on the Home Page

    Tonight I got a comment on my blog, and noticed that it displayed on the homepage in the "What's New" list. That's weird; certainly not how Community Server used to behave. Anyway I set about to fix it. I found a couple of articles on the subject, but none that I felt were quite right.

    The last one I found, while not an ideal solution IMHO, lead me to a much better solution.

    Near the top of the Themes/[theme]/Common/home.aspx file, there is a C# code block which performs the search if there is nothing in the cache. It is within this code block that I added the following line of code:

    query.UsersToSearch = new int[] { <enter user id(s) here> };

    I tried using the UserNamesToSearch property first, but it didn't seem to change the results.  The value passed in is the value in the UserId column for the desired users in the cs_Users database table.

    Along with restricting which results display, you can also change how many results are displayed on the home page by changing the PageSize property assignment.

    Note: the user restriction works for my site because I am the only user. If you have more than one user on your site, you can either add all the users, or you may need to use one of the other solutions.

    Update (7/21/2007):

    When I came up with this solution, I somehow overlooked the fact that I myself might post a comment in reply to another comment.  So I am back to implementing the last one I found.

  • Hacking Community Server: Event Calendar Intro

    This post starts off a five-part series on adding an event calendar to Community Server 2007.

    Many communities need the ability to track their events. Unfortunately, there is no event calendar within Community Server. We need to design an easy-to-use event calendar system for Community Server 2007 to enable site owners to post and edit events, as well as allow users to view events, subscribe to event feeds via RSS, and download ICS event data. Site owners should also be able to add custom event controls to sidebar areas, and edit their event data within the existing Control Panel.

    The true value of Community Server 2007 lies in its robust extensibility architecture. It is through this extensibility architecture that I will guide you, step by step, on extending Community Server to provide an event calendar. The steps are outlined below, and will each be a post unto themselves.

    • Part 1: Full-Blown Dynamic URL Rewriting
    • Part 2: Adding your own provider and application
    • Part 3: Build themed user controls
    • Part 4: Adding your own administration pages
    • Part 5: RSS, and (tbd)

    Stay tuned for the first episode of Hacking Community Server: Event Calendar.

    Update (9/23/2007): While this particular series has been cancelled, I have completed and added the event calendar to my site. Check the Events menu item above.

  • Announcing: Philly Geek Dinner - July 2007

    A couple weeks ago I attended a North Jersey geek dinner event, and a great time was had by all. For those who are not familiar with geek dinners, it is basically a bunch of folks from the local .NET community who get together for a casual dinner event, similar to pub night. It's a chance to hang out and get to know your local geeks.

    I started thinking that we should have these events in our area, and figured I'd get the ball rolling.

    The rules are simple, there are no rules. Just show up. Everyone pays for their own drinks/food.

    So I am announcing our first (that I know of) Philly geek dinner:

    When: Tuesday, July 24th 2007
    Time: 6:30 PM
    Where: Baxter's, Great Valley

    Feel free to forward this invite around, the more the merrier.

    See you all there and please leave a comment below so we know to look out for you.

    Posted Jul 18 2007, 10:40 AM by Steve with 3 comment(s)
    Filed under:
  • Hacking Community Server: Remove Group List

    I only have one blog on my site, so I felt there was no need to display the blog Groups list on the main blog page. It's simple enough to take out.

    Open up the Themes/[theme]/Blogs/blogs.Master file, and comment out the CSBlog:GroupList control, as shown below:

    <%--<CSBlog:GroupList runat="server">
        <QueryOverrides GroupID="-1" />
        <LeaderTemplate>
            <div class="CommonSidebarArea">
                <div class="CommonSidebarRoundTop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>
                <div class="CommonSidebarInnerArea">
                    <CSControl:ResourceControl ResourceName="Groups" Tag="H4" CssClass="CommonSidebarHeader" runat="server" />
                    <div class="CommonSidebarContent">
        </LeaderTemplate>
        <HeaderTemplate><ul class="CommonSidebarList"></HeaderTemplate>
        <ItemTemplate><CSBlog:GroupData LinkTo="GroupHome" Property="Name" runat="server" Tag="Li" /></ItemTemplate>
        <FooterTemplate></ul></FooterTemplate>
        <TrailerTemplate>
                    </div>
                    <CSControl:SiteUrl UrlName="webloghome" ResourceName="ViewAllGroups" Tag="Div" CssClass="CommonSidebarFooter" runat="server" />
                </div>
                <div class="CommonSidebarRoundBottom"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>
            </div>
        </TrailerTemplate>
    </CSBlog:GroupList>--
    %>

    If you also want to remove the "Blogs on this Site" link, comment out the control about 8 lines above the previous section, as follows:

     

    <%--<CSControl:SiteUrl ResourceName="Bloggers" UrlName="blog_aggregate_Bloggers_default" Tag="Li" runat="server" />--%>

    That's it. I wish they were a setting in the admin, though.

  • HyperCard Follow-up

    In a follow-up to my HyperCard post, I finally got my Mac to turn on, and found some pretty cool stuff.

    In browsing through the old HyperCard stacks, FileMaker Pro documents, and SuperPaint files I found an interesting 'article' I wrote in 1993 when I was 15 years old. It describes in not-so-technical detail of how to facilitate Mac and IBM PC communication through intermediary hardware. It is really funny reading it now, knowing what I didn't know back then. It's also pretty cool, considering the WWW only came into existence in 1991. Here is the exact text from the document, which is under the pretense of a fictional news report.

    It has been said to be impossible. "There is no way it is possible!" said Ian Russell, graduate of Carnegie Mellon. "If it is ever done, it will break the barrier between Macintosh and IBM users forever" another gentleman said. Well, little did they know what was going to evolve from the depths of a small community college in northern Massachusetts? It was late Saturday night about two years ago that the idea was derived, by a Senior, from the book "Possible Computer Advances for the next 50 Years". He then spent the next two years with the head of the computer department working on this project. At the young age of 22, Matthew Russell is the youngest person to create an idea and develop it into major computer advance. In the form of a modem cable, you would hook one end into your computer, the other end would plug into the other computer, the one you would like to have conversations with. In the center of this wire is a little black box. About the size of an A/C adaptor. Inside this little black box are a few wires, and a computer chip which stores about 250 MB of info. It is this little computer chip that does all of the processing between the two machines (Mac to IBM & IBM to Mac). For example, let's say that you were computing an essay from an IBM machine to a Macintosh. The information would travel out the modem port of the IBM, through the cable, and into the little black box. The computer chip then takes the info and computes it. To fully explain this process I have drawn you a VERY rough sketch of a cross section of the box, from the side view.

    [ unable to convert image from Mac, but it was pretty poor anyways <g> ]

    On the left side is the IBM input, and on the right, the Mac input. The squiggly lines that are running from the inputs to the chip, are the cables that carry the information. The chip is designed in a Mac to IBM format when the info is coming from the Mac. In other words, when the info comes from the Mac, it goes through the chip which changes it into an IBM compatible language. When the info is coming from the IBM it goes through the same process, in reverse to change it into a Mac compatible language. That is all of the info I could get, the rest is still pretty classified, from the public.

    Little did I know that the translation processing would not happen in the middle (which would be very impractical), but rather it would take place on the host and client machines in the form of TCP/IP and Ethernet.

    I guess I am still trying to work on the interoperability issue. I spent a number of years in my career working on custom middleware applications to connect legacy systems.

    BTW, I wish I knew what I had imagined was in the rest of that book!

  • I can’t figure out how to...

    Here's an oldie that I never posted, maybe it's still a goodie? Pardon the inherited poor humor.

    I have spent a fair amount of time on the MSDN managed newsgroups lately answering posts, and generally trying to get folks headed in the right direction, or at least away from the wrong one. Most questions are the same ones I asked early on, and I'm glad to be able to help them out like some folks did for me when I was starting out. Sometimes though, I am amazed by what developers are trying to accomplish. Stuff like rotating a ProgressBar?

    What I've found is that when I hear myself saying "I can't figure out…", or I've run into a tangled quagmire of unnecessary spaghetti code, is that I need to step back and look at the business requirements and my architecture. Sometimes I find that I am trying to do something the 'wrong way' and I should re-examine how to achieve the business goals.

    Like Albert Einstein said, "Make everything as simple as possible, but not simpler."

    Something to keep in mind.

  • TFS Project Names

    Quick Tip:

    One important thing to remember when creating TFS projects from Visual Studio, is that including a period (".") in the project name will cause the project creation to fail. MSDN simply states that a period cannot be at the beginning or the end. I have experienced failures including a period at all.

    More tips on TFS naming restrictions are available on MSDN.

    Posted Jul 17 2007, 04:33 PM by Steve with no comments
    Filed under: ,
  • Hacking Community Server: Editable Footer

    I have completed the aesthetic upgrades to my site that I could with the new Chameleon interface in Community Server 2007. Now it is time to do the fun stuff. One of the things I wanted to do was make the footer area an editable content area, but I didn't want to have to modify the Themes/[theme]/Common/master.Master file every time, like for copyright date changes.

    In Community Server, there is a built in control just for this purpose. It is called a ContentPart control, and it is located in the CommunityServer.Controls assembly. There is no need to dive into Reflector, however. All that is required is adding a couple additional tags to a theme file where you want the editable content to live.

    First, to the BodyFooterRegion ContentPlaceHolder control, which serves up the "Powered by Community Server" image seen below, I added style="float: right;" to keep it out of the way of my content.

    Then, below the ContentPlaceHolder, I added the following tags and controls:

    <div style="width: 650px;">
         <CSControl:ContentPart ID="ContentPart1" runat="server" ContentCssClass="CommonContentPartBorderOff"
             ContentHoverCssClass="CommonContentPartBorderOn" ContentName="footer-default">
             <DefaultContentTemplate>
                
    <!-- Default Content Here -->
             </DefaultContentTemplate>
         </CSControl:ContentPart>
    </
    div>

    One important note: Make sure you assign a unique ContentName to each ContentPart.  The names already taken by Community Server, that I am aware of, are welcome-default and featured-default.

    And that's it for the editable footer. Now all that remains is to double-click on the footer and edit to your heart's content.

     

  • Site Upgrade – Update 2

    The aesthetic update is done for now. There are a couple more things I want to do, but they require changing the .ASPX files, and I wanted to see how far I could get with the new Chameleon stuff in Community Server 2007. Not too bad I guess. The CSS override option is what saved me. I found Firefox with the Developer Toolbar to be immensely valuable during that process. I was forever using the CSS > View Style Information to see what the current styles were for an element, so I could override them.

    So the new look & feel is up, for now. Hope you like it.

  • Site Upgrade – Update 1

    So I finally got Community Server 2007 installed, well upgraded from version 2. Seeing how I just spent the better part of 9 hours doing it, I thought I'd recap for anyone who might run across the issues I did.

    The main issue I encountered occurred when I uploaded the new content files, and installed the database update script. When I tried to access the site, I got an exception "Specified cast is not valid." No matter how much kanoodling I did with tracing, compilation debug and turning off custom errors, I could not find a real answer as to the source of the problem. The only real clue was that the stack trace ended at "CommunityServer.Components.CommonDataProvider.PopulateUserFromIDataReader." I check out the method in Reflector, and sure enough it is unboxing values from the database, which must mean that the problem is at the database level.

    To back up a sec, I host with GoDaddy. They don't allow remote access to their databases, and their web UI tool is pretty bad, so I've been using the Database Publishing Wizard and Service. I couldn't use either of the two methods listed for deployment, so I used the alternative option. Unfortunately, I didn't realize that somehow the .SQL file was blocked to requests, and the updates never happened to the database. Ultimately, I ended up changing the extension to .TXT, and the script ran.

    So now Phase 1 is done, and we're onward and upward to Phase 2 – the fun part. I need to slice up my Photoshop files and integrate them into a CS theme. Oh, look at the hour! I guess I'll be doing this stuff tomorrow.

    Napte buna!

  • Site Upgrade

    For the two (2) of you who actually read this blog <g>, this weekend I will be attempting to upgrade Community Server on this site to 2007 and hopefully not delete all my blog posts in the process (yes, I have backups). Not only am I attempting to upgrade from version 2.1 to 2007, but I am also attempting to make it a single blog site in a subdirectory. We'll see whether THAT works or not. I'd imagine if all works out that the RSS feed URL will change as well.

    And if that's not enough, the driving force for these changes is that I have Photoshopped a totally new design for the site and I'd like to get it up there. I am never satisfied with the status quo, and there isn't much status in the current design to quo with.

    Yup, this is what I do for fun!

  • Another one bites the dust!

    Today I took and successfully passed the Microsoft 70-528 exam (Web Apps). Woohoo! As with the last one, it was much harder than I thought it would be with lots of obscure and ambiguous questions. Someone needs to tell the Microsoft Learning guys that Visual Studio now has IntelliSense. I only took the 70-536 exam last Friday, but I've been working with ASP.NET for awhile, so I was able to breeze through a bunch of the objectives. That and I am currently an unassigned consultant, so I have 40 hours+ a week to prepare. Unfortunately, I know that won't last, but I'm also looking forward to diving back into the game.

    Next up is either the 70-529 (Distributed Apps) or the IBM RUP certification. I'm taking the weekend off from studying; I'll figure it out Monday.

  • Programmer Personality

    So I'm running through Google images trying to find a techEd banner ad for a web site I'm Photoshopping, more on that later. Along the way I happen to stumble upon a Programmer Personality Test. I like things that fit into neat little boxes, so what the heck. I took the quiz, and here are the results:

    Your programmer personality type is:

    DHSC

    You're a Doer.

    You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.

    You like coding at a High level.

    The world is made up of objects and components; you should create your programs in the same way.

    You work best in a Solo situation.

    The best way to program is by yourself. There are no communication problems, and you know every part of the code allowing you to write the best programs possible.

    You are a Conservative programmer.

    The less code you write, the less chance there is of it containing a bug. You write short and to the point code that gets the job done efficiently.

       

    I guess this is mostly accurate. I would argue that I sure appreciate a team effort way more than I used to. After all, I'm no Superman.

  • Restricting Access to Trace.axd

    I am currently prepping for the Microsoft 70-528 exam – .NET Framework, Web Application Development. Despite having worked with ASP.NET for several years now, I still find myself learning new things. I scored 80% and 84% on two practice tests before even beginning to study, so I guess I have 16-20% left to learn. Take tracing. I know about tracing, but I was never aware of the Trace.axd handler. I was stoked, here is a way to help remote debug a website. Or so I thought. It seems that Tracing is either on or off. Once it's on, any request to trace.axd will succeed, even from invalid paths. There seems no way to be able to restrict access to, say, just logged in administrators.

    For the purists out there, let me add a word of caution. Tracing is not meant to be used in a production environment. There are significant security risks, as well as performance issues. In a production environment, use Health Monitoring, Performance Counters, the Event Log and other such forms of error handling.

    But back to my dilemma, my first thought was to set up location authorization rules in Web.config to allow only admins to be able to see the file. But invalid paths serve up the Trace.axd file as well (http://localhost:1215/WebSite1/testhjgeoiheoigheoihgiesub/trace.axd) so there is no way to block it there. Assuming the full 128 character ASCII range, and the full 2083 character range of URLs in IE, ASP.NET would eat up 2.0814538037914702336086584856065e+4389 bytes of memory just trying to load the Web.config file (SWAG number). Talk about a maintenance nightmare. No, there has to be a better way.

    The problem I ran into is that the httpHandlers path is essentially "^.*trace.axd". Anywhere in the URL it falls, it is served. On the other hand, the location authorization wanted a virtual path from the root "^/trace.axd$".

    For the time being, here's what I ended up doing, and it's not pretty.

    <httpHandlers>
    <remove path="trace.axd" verb="*" />
    <add path="MyVeryHardToFindUrl/trace.axd" verb="*" type="System.Web.Handlers.TraceHandler" validate="True" />
    </httpHandlers>

    I told you it wasn't pretty, and it's not quite foolproof either. Any path will work, as long as it ends with the handler path. Until a better solution comes along, or I write my own TraceHandler to limit the output to a single path, this'll have to do.

    Posted Jul 08 2007, 09:15 PM by Steve with no comments
    Filed under: ,
  • Did I mention I hate computers?

    I dunno, maybe I've had one too many Yukon Jacks, but I must agree with Scott Hanselman, I hate computers. They are always screwing up in the most obscene ways. I love programming, but I hate computers. Sure, I understand that even when they screw up for completely illogical reasons, that there is a logical reason under the covers. But I don't understand it, and it takes way too much time to figure out. You would think that at this point in the game the hardware part would be easy.

    Take my new server for example. I was trying to set up RAID for the SCSI drives, and it just wouldn't work. It took me a whole day of fiddling with it to figure out that the firmware needed to be updated. At least with software the fixes are easy. I wish the hardware guys would fix this stuff too.

    I don't think it has anything to do with me seeing straight though, when hardware doesn't work, it just sucks, and you gotta wonder what they were thinking.

    L8er

  • I am now an MCP!

    I took the Microsoft 70-536 .NET Framework Foundation exam today and passed! Whew, it was kind of scary. I haven't taken an exam in over ten years, not since college.

    I spent about two weeks studying. I read the MS Press book, and read it again. Then I took the tear-out objectives worksheet and typed it into Word 2007 as an outline, filling in the pertinent details of each exam sub-objective. It took awhile, almost 40 pages, but it was worth it. The test was way harder than I thought it would be, and covered some pretty obtuse topics. I'm also a VB guy and I took the test in C#. The whole way through I was thinking, "I'm gonna fail", "wait, this wasn't in the book", "I'm gonna fail". Even after the exam, when I hit the end button, I was expecting the next screen to say "You FAILED you LOSER!" But low and behold, "Congratulations, you passed."

    I guess I don't give myself enough credit. My sister-in-law likes to joke that I don't just write software, I am software, it's who I am. Maybe she's right. Well, it's off to the races again for the 70-528 Web Apps exam.

    MCPD:EAD here I come!

Powered by Community Server (Commercial Edition), by Telligent Systems
© Platinum Bay | Some Rights Reserved Creative Commons License

Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or annonymous comments) - so keep it polite, please.