Jun
26
2010

Jobping announcing StickyBeak

As said when we launched Jobping Open Source Short Urls Service, we at Jobping are committed to open source.

So last week we announced  StickyBeak, you might read more on the blog of Mark - Introduction to StickyBeak

StickyBeak is a logging tool for asp.net websites which logs information such as date, http method, url, User.Identity.Name, IP Address, unique session Id, unique browser Id, header values, querystring values, posted form values and cookie values for every request.

Here is a screenshot of the administration page,which lets you see the logged activity on your site.

StickyBeak is a complementary tool to the excellent elmah from Atif Aziz

We are using elmah on Jobping to log exceptions that might happen on the site, but we also wanted a raw record of each request made to our site, to make our troubleshooting life easier.

You can download the source and binaries from StickyBeak on CodePlex.

Dec
2
2007

Setting correctly your configuration for Web Deployment Projects VS08

I read on MSDN Forums that it is not possible to use other configuration than Release and Debug. This is wrong.

I am using it for Tech Head Brothers Portal, what you have to take care of is how you set your configuration. On the following picture you see how I defined a new Staging configuration and set the Web Deployment Project WebApplication.csproj_deploy to build using this configuration.

Then you are able to use it this way in your MSBuild:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Staging|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>.\Staging</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>THB.Portal</SingleAssemblyName>
</PropertyGroup>
Dec
2
2007

Web Deployment Projects for VS08 released as CTP &amp; Migration tips

My old build script wasn't working after the migration to this new version and you will find in this post the different adaptation that I had to do.

Add missing ToolsVersion as following:

<Project DefaultTargets="Build" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
         ToolsVersion="3.5">
Replace
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets"/>

with

<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets"/>

I also had to add the following to the beginning of my AfterBuild task:

<Target Name="AfterBuild">
  <CreateItem Include="$(TempBuildDir)\**\*.*">
    <Output ItemName="CompiledFiles" TaskParameter="Include" />     
  </CreateItem>
  <Exec Command="if exist &quot;$(WDTargetDir)&quot; rd /s /q &quot;$(WDTargetDir)&quot;" />
  <Exec Command="if not exist &quot;$(WDTargetDir)&quot; md &quot;$(WDTargetDir)&quot;" />
  <Copy SourceFiles="@(CompiledFiles)" DestinationFolder="$(WDTargetDir)\%(CompiledFiles.SubFolder)%(CompiledFiles.RecursiveDir)" />
  <Exec Command="if exist &quot;$(TempBuildDir)&quot; rd /s /q &quot;$(TempBuildDir)&quot;" />
  ...
</Target>

Otherwise I ended up with TempBuildDir folder with a part of my solution. This is just a copy of what is defined in Microsoft.WebDeployment.targets.

Now everything works like before, I can:

  1. set Staging as my active solution configuration
  2. Run a compilation
  3. Zip the merged result of the build
  4. Start uploading using ssh to the target stage server

Nice!

Aug
19
2007

Yahoo release a web site evaluation tool called YSlow

YSlow is a new web tool published by Yahoo. It let you test a total of 13 rules against your web site to check if it is efficient.

YSlow is an addin to Firefox integrated in the web development tool Firebug.

You might read the rules that are verified on this page : Thirteen Simple Rules for Speeding Up Your Web Site and the documentation is on this page : YSlow User Guide.

There is also a screencast on this page : YSlow Podcast Interview and Screencast Demo.

Performance view

YSlow analyze the web page and generate a global mark and one mark per rules tested.

This is the gui of YSLow showing the result of the analysis of Tech Head Brothers main page. You can see the global mark of C (not so bad ;) and the different marks per rule. For example a D for the rule "Make fewer HTTP requests". You can opne up each section that didn't get a A to see what might be better.

We can see on the previous picture that YSlow identified that we are doing 11 requests for different JavaScript files. When you click on the rule you get a new web page with the explanation of the rule.

Stats view

YSlow compute the total size of a web page with and without the use of the cache and also give you some information on cookies.

You can see clearly the impact of the cache on your web application. On the previous screen shot you see that the browser needs to download 127.3 Kb with 21 HTTP requests without the cache and this numbers drops to 28.2 Kb and 5 HTTP requests with.

Components view

You get also a complete list of all the components of your page, included their type, URL, expiration date, gzip status, loading time , size and ETag.

Menu tools

The last menu let's you display the whole Javascript and CSS used by your web page to get a global view. It gives you also a web page with the result of the test on one page. The last part is JSLint checking the Code Conventions for the JavaScript Programming Language.

 

YSlow is a tool that might be usefull when you come to the optimization of your web site.

Jul
7
2007

Starting ASP.NET Development Server from a right click in explorer

Update: Following the comment of Jon Galloway

I know that there are other solutions doing this but I was just asked about how to do it today (hey Christine ;) and had this registry file stored somewhere for a while waiting for a blog post.

Save this to a file with an extension .reg, e.g. "asp.net web server here.reg":

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer]
@="ASP.NET 2.0 Web Server Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer\command]
@="C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:9081 /path:\"%1\""

You might also change the port used to start the ASP.NET Development Server. If this option is not specified then the port 80 is used.

Then double click on the .reg file to save the settings in the registry.

Now you will have access to the following right click menu in explorer and you can browse your site without running Visual Studio:

Update: This is not needed anymore

You will need to copy hstart.exe to your C:\Windows\system32\ first, or change the path used in the .reg file. This little tool (3kb); Hidden start, by NTWind Software is really good for "small startup manager that allows console applications to be started without any windows in the background.". Exactly what is need in our case.

Jun
8
2007

ASP.NET Pageflow

I don't get it!!! I thought that pageflow will be soon integrated into ASP.NET directly! When will it be and in which form ?

It turned out that the code we showed at TechEd wasn't going to end up in any of the product releases, so the dev team requested permission to release that code as a sample of how one can implement a generic navigation framework using WF that can support multiple UI technologies (i.e. ASP.NET and WPF). 

Matt W's Windows Workflow Place

May
5
2007

CSS Adapters issues with Login controls

If you are using ASP.NET 2.0 CSS Friendly Control Adapters 1.0 with the Login controls of ASP.NET 2.0 you might have experienced some issue like multiple postback when using Internet Explorer. You might get a GREAT fix and explanation of the issue from Tana Isaac of Wellington, New Zealand.

Double Postback Problem - Cause (skip this if you just want the fix!):

Buttons that reside within the controls that are adapted by the CSS Control Adapters, for example the CreateUserWizard.CreateUserButton, are rendered out differently depending on the button type (which is set for example via CreateUserWizard.CreateUserButtonType = ButtonType.Link). The default button type used by the membership controls is Button. The following html controls are rendered out for the different System.Web.UI.WebControls.ButtonType enum values:

ButtonType.Button: input, type=submit
ButtonType.Image: input, type=image
ButtonType.Link: anchor

Both of the input controls will automatically cause the form that they reside within to be posted back to the server when they are clicked, whereas the anchor will not - instead it needs some javascript to cause a postback. This is where the problem is - all three html controls are rendered out with javascript attached to post the form back to the server on a click event, which allows buttons of type 'Link' to work correctly but causes buttons of type 'Button' and 'Image' to postback twice - the first time due to the javascript and the second because of the native postback.

The javascript method used to cause the postback is as follows:

WebForm_DoPostBackWithOptions(WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit))

In order to stop 'Button' buttons and 'Image' buttons firing twice we just need to set the clientSubmit parameter to false when these types of buttons are rendered out.

Other problems (specific to the CreateUserWizardAdapter control)

Once the double postback problem was fixed two other problems popped up. The first was that users still weren't being created. This was because the id and name (which is derived from the id) being used for the create user button was missing an underscore.

The other problem was that the cancel button didn't work. It was also missing an underscore from its name and also wasn't registered for Event Validation.

Read more...

Great work Tana, Thanks for sharing you saved me some time.

Update: The CSS Adapters project is now hosted on Codeplex, http://www.codeplex.com/cssfriendly.

Mar
27
2007

ASP.NET AJAX and ASP.NET Validators

If you are using ASP.NET Validators in UpdatePanel consider the post of Matt Gibbs : "ASP.NET AJAX Validators".

ASP.NET AJAX provides new APIs for registering script with the ScriptManager.  Using these APIs allows controls to work well with partial rendering.  Without them, controls placed inside an UpdatePanel won't work as expected. In previous CTP releases of ASP.NET AJAX, we had a set of validator controls that derived from the v2.0 controls and used the new APIs. This made them work well with ASP.NET AJAX. WindowsUpdate will soon include a version of System.Web that can take advantage of the new APIs.  So the new controls which would have been redundant have been removed.  However, the update isn't available yet and ASP.NET AJAX has been released.  So, in the short-term, the source code for a set of custom validator controls that work with partial rendering is available here.

The .zip file includes a solution and .csproj file as well as the compiled DLL.  Just put the DLL in the /bin directory of your application and include the following <tagMapping section in the pages section of the web.config.

      <tagMapping>
        <add tagType="System.Web.UI.WebControls.CompareValidator"           mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.CustomValidator"            mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RangeValidator"             mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RequiredFieldValidator"     mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.ValidationSummary"          mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
      </tagMapping>

Jan
28
2007

Login control in an ASP.NET AJAX toolkit PopupControlExtender with a close button

I remember when I tried to implement a Login control in a ModalPopup with one of the early release of what was called at that time Atlas and is now called ASP.NET AJAX. I had lots of difficulties and now it works like a charm.

This time I would like to have a Login control in an ASP.NET AJAX PopupControlExtender from the ASP.NET AJAX Control Toolkit.

The implementation is really straight, a panel with a asp:Login in it:

<asp:Panel ID="loginPanel" runat="server" Style="display: none">
    <asp:Login ID="LoginCtrl" runat="server" 
        CssSelectorClass="THBLogin"
        FailureText="Identifiant incorrect ! Essayez ? nouveau..."
        LoginButtonText="S'identifier" 
        
        PasswordLabelText="Mot de Passe" 
        PasswordRequiredErrorMessage="Le mot de passe est requis."
        RememberMeText="Se souvenir de moi la prochaine fois." 
        TitleText="S'identifier"
        UserNameLabelText="Email" 
        UserNameRequiredErrorMessage="L'email est requis." 
        CreateUserText="S'enregistrer" 
        CreateUserUrl="/Register.aspx" 
        PasswordRecoveryText="Mot de passe oubli? ?" 
        PasswordRecoveryUrl="/PasswordRecovery.aspx" />
</asp:Panel>

Then you had the PopupControlExtender:

<ajaxToolkit:PopupControlExtender ID="PopEx" runat="server"
    TargetControlID="loginHyperLink"
    PopupControlID="loginPanel"           
    Position="Left" />

I also need a target control that will initiate the Popup display:

<asp:HyperLink ID="loginHyperLink" runat="server">S'identifier</asp:HyperLink>

Till now nothing really special.

Then I wanted to add a close button to this Popup, so I a added a div closeLoginPanel with an embedded link:

<asp:Panel ID="loginPanel" runat="server" Style="display: none">
    <div class="closeLoginPanel">
        <a title="Fermer">X</a>
    </div>
    <asp:Login ID="LoginCtrl" runat="server" 

This is not enough because I need to have the close action started when a user click on the link (X). I first looked at the javascript of the PopupControlExtender and saw that it handles the onclik of the body element so I added

<a onclick="document.body.click(); return false;" title="Fermer">X</a>

This was working fine on Internet Explorer 7 but was raising an error on FireFox 2. Looking in more detail in the javascript I finally changed my code to:

<a onclick="AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup(); return false;" title="Fermer">X</a>

This is working on both Internet Explorer and FireFox 2.

Here is the css I used:

.closeLoginPanel
{
    font-family: Verdana, Helvetica, Arial, sans-serif;
    line-height: 17px;
    font-size: 11px;
    font-weight: bold;

    position: absolute;
    top:8px;
    right: 10px;
}

.closeLoginPanel a
{
    background-color: #6699CC;
    cursor: pointer;
    color: #FFFFFF;
    text-align: center;
    text-decoration: none;
    padding: 5px;
}

Here is the result:

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List