Category Archives: Uncategorized

Forms Authentication static content not loading

Using forms authentication, you may find that your css is not being applied, or other such static media isnt loading when you are not authenticated, ie when not logged in.

In order to diagnose where the problem is you need to understand how forms authentication walks hand in hand with IIS regardless if you are forcing all requests through the .net api or not.

The Scope of Forms Authentication

The FormsAuthenticationModule is managed code that is part of the ASP.NET runtime. Prior to version 7 of Microsoft’s Internet Information Services (IIS) web server, there was a distinct barrier between IIS’s HTTP pipeline and the ASP.NET runtime’s pipeline. In short, in IIS 6 and earlier, the FormsAuthenticationModule only executes when a request is delegated from IIS to the ASP.NET runtime. By default, IIS processes static content itself – like HTML pages and CSS and image files – and only hands off requests to the ASP.NET runtime when a page with an extension of .aspx, .asmx, or .ashx is requested.

IIS 7, however, allows for integrated IIS and ASP.NET pipelines. With a few configuration settings you can setup IIS 7 to invoke the FormsAuthenticationModule for all requests. Furthermore, with IIS 7 you can define URL authorization rules for files of any type. For more information, see Changes Between IIS6 and IIS7 Security, Your Web Platform Security, and Understanding IIS7 URL Authorization.

Long story short, in versions prior to IIS 7, you can only use forms authentication to protect resources handled by the ASP.NET runtime. Likewise, URL authorization rules are only applied to resources handled by the ASP.NET runtime. But with IIS 7 it is possible to integrate the FormsAuthenticationModule and UrlAuthorizationModule into IIS’s HTTP pipeline, thereby extending this functionality to all requests.

If you want IIS to integrate the dynamic and static content with the forms authentication module you set your application pool to “integrated” mode, if not you set it to “classic” mode, separating the authentication module from the static content such as css files and other such media.

Configuring forms based authentication

you typically use the webconfig file to setup security topology of your website, below is n example of a webconfig root entry to apply security to folder and files of your website application

here we are allowing all users to have access to the folder “css” found on the root of the web application

similarly here we grant access to all users for the themes folder

In this example we want only those users in the Admin role to have access to the contents of the Admin folder

Another post you may find useful

low carbon economy

This is a little different from my usual tech natter

Ive spent the last 4 months working solidly on our company website, transforming it into a usable useful resource, and there is much much more to come.
But for now I think what we have is a vast improvement on what was there.

I proudly present the Low Carbon Economy Ltd


Please feel free to leave commits for feature request, problems, issues, bugs, and anything else you think might help us in the fight to help this site grow.

The SQL Server Service Broker for the current database is not enabled

Easy fix for this common little error.

The SQL Server Service Broker for the current database is not enabled, and as a result query notifications are not supported. Please enable the Service Broker for this database if you wish to use notifications

Simply Execute the following against the target DB

If the above statement results in an error try the following

jquery textarea autoresize

I was looking for the cool factor that you get when you use facebook to respond to wall posts

The closest I came to was this chap .James Padolsey who wrote a nice plugin for textarea resizing

The only thing I added was the ability to paste content into the textarea, I’ve written to him so hopefully he’ll update his plugin.
If not heres where you update the plugin.
Look for the textarea .bind list and change it to :>

jcarousel No width / height set for items

If you use jquery, then the chances are you are using the jcarousel library.

Well im new to jquery but have come along at an accelerated rate, perhaps because of my OO background.

Ok so you hit this page likely because you got this error

jCarousel: No width/height set for items. This will cause an infinite loop. Aborting…

When i tried to nail down what the cause was i stumbled across a post that told me to add css styles for width and height. This was all well and good until i wanted to apply styling to more than one carousel on the page. Anyway what took me a few hours to figure out I support open and collaborative minds by sharing it here.

The error occurs regardless of widthand height attribute of you jarousel item. You need to set the width and height of the first parent of the carousel. If you follow this design pattern below, you cant go wrong

Firstly im assuming you have already included a reference to your already downloaded jcarousel library. There is really only one of them so you cant go wrong in finding it. here

1. Markup for your page containing the jcarousel element (note wrapped in a containing div)

Your initialising jscript to bring your carousel to life (note applied to the ordered list)

Your CSS (note applied to the wrapping div)

The reason why we do this is because the jcarousel class ammends the html markup so that styles will no longer apply because the objects will no longer exist, or have the same name at the jcarousel object level.

Hope this helped those who were stuck as I was.

JavaScript window.SetTimeout to javascript class method passing object/parameter

I notice people have been struggling with calling a class method and passing a parameter through to it when using the window.setTimeout javascript timer

In my current search engine proejct I am both calling the settimeout method from within my class, assigning the id to a class parameter, incase i want to cancel it before it hapopens, and passing the current call object through to the target class method, setting my delay from a class global delay variable.

The trick is to place an inline function into the expression of the setTimeout call like so :-

Inside my input handler (this is fired from keyup, keydown, paste and various other change events on the page)

Hope this helps those that might have been struggling with this.