Bundling and Minification

Fantastic post about ASP.Net bundling & minification by Scott Gu

http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx

Advertisements

Intellisense has stopped working

A great post on stackoverflow.com resolves the issue. Thanks Gordon Bell

http://stackoverflow.com/questions/178846/visual-studio-intellisense-stopped-working

This has resolved issues in the past with Telerik.Web.UI not working or using an older version even after upgrading Telerik using the windows installer.

This configuration section cannot be used at this path….!!??

By default within Windows 7 IIS 7.5 Microsoft has locked down the parent security requiring that you explicitly allow certain functions for them to be overridden by using either the IIS interface or by your apps web.config file.

For example I received the following alert in IIS when my web.config file had “Anonymous Authentication” turned on. This alert is displayed when trying to manage the authentication settings within IIS.

“There was an error while performing this operation”
”Error: This configuration section cannot be used at this path.This happens when the section is locked at a parent level. …”

image

Resolution

  1. Open windows explorer c:\Windows\system32\inetsrv\config\
  2. edit applicationHost.config in notepad
  3. Look through xml and change relevant tags from Deny to Allow

In my case I needed to allow anonymousAuthentication so I changed the following:

<sectionGroup name=”authentication”>
<section name=”anonymousAuthentication” overrideModeDefault=”Deny” />
<section name=”basicAuthentication” overrideModeDefault=”Deny” />
<section name=”clientCertificateMappingAuthentication” overrideModeDefault=”Deny” />
<section name=”digestAuthentication” overrideModeDefault=”Deny” />
<section name=”iisClientCertificateMappingAuthentication” overrideModeDefault=”Deny” />
<section name=”windowsAuthentication” overrideModeDefault=”Deny” />
</sectionGroup>

to:

<sectionGroup name=”authentication”>
<section name=”anonymousAuthentication” overrideModeDefault=”Allow” />
<section name=”basicAuthentication” overrideModeDefault=”Deny” />
<section name=”clientCertificateMappingAuthentication” overrideModeDefault=”Deny” />
<section name=”digestAuthentication” overrideModeDefault=”Deny” />
<section name=”iisClientCertificateMappingAuthentication” overrideModeDefault=”Deny” />
<section name=”windowsAuthentication” overrideModeDefault=”Deny” />
</sectionGroup>

Path to config file: c:\Windows\system32\inetsrv\config\applicationHost.config

Telerik Grid – Event Handlers

I am writting this article because its very common to use event handlers on grids and I find that im always forgetting how to access columns, rows data, datakeynames etc. So i have put together a list below of methods i commonly use.

 

OnNeedsDataSource

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource

	RadGrid1.DataSource = New CommsBLL().GetInbox(HttpContext.Current.User.Identity.Name)

End Sub

 

ItemDataBound

This event is called after the row has been added to the grid allow you to access any controls/data that has been bound.

Access a column contents

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        'get grid row
        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then
            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            item("columnName").Text = "new value"
        End If
End Sub

Access DataKeyName and add new controls to column

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
            Dim status As String = item.GetDataKeyValue("status")
            Dim cell As TableCell = item("status")

            cell.Controls.Clear()
            Dim image As New Image
            If status = "Unread" Then
                image.ImageUrl = "/clips/icons/newmessage.gif"
            ElseIf status = "Replied" Then
                image.ImageUrl = "/clips/icons/replied.png"
            Else
                image.ImageUrl = "/clips/icons/readmessage.gif"
            End If
            cell.Controls.Add(image)

        End If

    End Sub

ItemCommand

Protected Sub FinancialsGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles FinancialsGrid.ItemCommand

        If e.CommandName = "Delete" Then

            Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

            Dim transactionID As Integer = item.GetDataKeyValue("TransactionID")

            'etc

        End If

    End Sub

post asp.net 3.5 sp1 – authentication error

I had a script using webclient(), after installing .net 3.5 sp1 the webclient stopped working correctly. The following article explains further.

http://blogs.iis.net/webtopics/archive/2009/06/10/why-system-net-webexception-comes-up-post-net-framework-3-5-sp1.aspx

Alternate Access Mappings – 2010

Sharepoint 2010 Issue

With the introduction of the client API, and a few other services, Microsoft is now making use of the WCF for its web services.   These offer lots and lots of advantages,  but have one limitation (at least in 3.5) that makes the above scenario fail.

You cannot have multiple bindings on any IIS website

http://www.21apps.com/sharepoint-2010/sharepoint-2010-and-multiple-urls/