Uncategorized

Creating a nuGet package

Creating a nuGet package

By |February 23rd, 2011|Coding, Uncategorized|0 Comments

Using ResolveClientUrl in MasterPage

A couple weeks ago I tried using ResolveClientUrl in my masterpage to properly link my javascript and CSS files in my MasterPage. When attempting to run the code:

<script src=’<%= ResolveClientUrl(“~/Assets/Includes/Javascript/jquery-1.4.2.min.js”) %>’ type=”text/javascript”></script>

I received a nasty error:

The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).

What?!? Well after some research I found an alternative solution using databinding, here are the steps I used to remedy the problem:

  1. Change your server side tags from <%=to <%#

    Example: <script src=’<%# ResolveClientUrl(“~/Assets/Includes/Javascript/jquery-1.4.2.min.js”) %>’ type=”text/javascript”></script>

  2. On the Master Page code behind in the Page_Load event place the following snippet of code:

    Page.Header.DataBind(); 

This should take care of the problem, if you are still having issues tweet me: @tekguy.

By |February 22nd, 2011|Coding, Uncategorized|0 Comments

A failure is a man who has blundered, but is not able to cash in on the experience. — Elbert Hubbard

By |February 22nd, 2011|Coding, Uncategorized|0 Comments

dowding:

The only valid measurement of code quality: WTFs/minute

By |February 22nd, 2011|Coding, Uncategorized|0 Comments

dowding:

The only valid measurement of code quality: WTFs/minute

By |February 22nd, 2011|Coding, Uncategorized|0 Comments

Easily switch browsers in Visual Studio 2010

Today I found an add-in for Visual Studio 2010 that allows you to easily switch the default debug web browser. Click here to download the add-in. Upon install also make sure to follow the instructions:

  • Restart Visual Studio 2010
  • Goto View -> Toolbars -> Default Browser Switcher

You should now see a new toolbar with 5 browser icons.

By |January 18th, 2011|Coding, Uncategorized|0 Comments

Linqpad

A couple months ago I stumbled upon a little app called Linqpad, its essentially a sandbox for testing out your linq queries.

Learn more by visiting http://www.linqpad.net

By |January 14th, 2011|Coding, Uncategorized|0 Comments

Understanding ASP.NET server side tags

ASP.NET has a numerous server side tag syntax, here is my attempt to explain them all:

<%
This is your basic tag for including server side code on a webform or view (MVC).
Example:

<%
     string testVar = “Hello”;
     if (testVar == “Hello”)
     {
          //do stuff
     }
%>

<%=
This is the equivalent of Response.write, this tag has been around since the classic asp days.
Example:
<%= Request.QueryString(“Variable”) %>

<%#
Used for outputting databound data via Eval and other databinding methods.
Example:
<asp:DataList ID=”dlPhotos” runat=”server”>
     <ItemTemplate>
          <%# Eval(“Filename”) %>
     </ItemTemplate>
</asp:DataList>

<%—
Server side commenting, comparable to <!— —> in HTML.
Example:
<%— <asp:Literal ID=”lcName” runat=”server” /> —%>

<%@
Used for directive statements, usually found atop your page.
Example:
<%@ Import Namespace=”My.Namespace” %>

<%:
Very similar to <%= but performs an HTML encode on the data.
Example:
<%: Html.Image(“~/images/test.png”) %>

By |January 13th, 2011|Coding, Uncategorized|0 Comments

Google Font Directory

Recently I learned about Google’s font directory. It features some cool open source fonts which you can integrate directly on your website using their API or download them for your image editing software.

Learn more by browsing http://code.google.com/webfonts

By |January 12th, 2011|Coding, Uncategorized|0 Comments

OWASP Top 10 for .NET developers part 6: Security Misconfiguration

OWASP Top 10 for .NET developers part 6: Security Misconfiguration

By |January 4th, 2011|Coding, Uncategorized|0 Comments