Archive for October, 2008

Impersonation in .Net

Posted by toby mills on Oct 22 2008 | ASP.Net, Technical developement

I’ve been struggling to get a project another developer has been working on to build on my machine, the main problem has been that the files within the App_Code folder did not recognise any of the dll’s or their class names and so other than the basic System and Microsoft namespaces I could not access anything. After quite a bit of frustration I have finally tracked down the issue…

The project uses windows impersonation to enable access to certain features within a CMS system this has been set in the web.config. It was set to use another user account and for the purposes of publishing the site I did not see any reason to change it. Oh what a fool I am. It seems that Visual studio actually uses these credentials to access files on the system and as the impersonated user has never logged onto my laptop (or perhaps his password has changed) VS would not allow the App_Code folder files to access the dll’s. Changing the impersonation settings to my own resolved this issue. So the conclusion is if you are using impersonation ensure the account is valid on the machine you are developing on and not just the one you run it on.

Alternatively to avoid this problem altogether DON’T user impersonation or use a generic network / domain account which is documented and shared with all other developers. The main reason for this is that if you use a personal account then it could be easily hijacked and series damaged could be caused because of your user privileges not to mention that your password will be visible in the web.config!

no comments for now

Yahoo’s Best practices for speeding up your web site

Posted by toby mills on Oct 22 2008 | Web Development, ASP.Net, Technical developement

A while back i came across this great website and subsequent tool for improving performance of a website and ever since have been meaning to blog about it.

The page has been created by Yahoo as a list of best practices when producing websites. Some of the items are only applicable to large websites, for example placing images on a separate domain, however by in large we can learn from them all. Although most of the items are obvious like reducing HTML/CSS/JS file sizes, some of the items where extremely interesting. For example one of the entries states:

 “When the browser makes a request for a static image and sends cookies together with the request, the server doesn’t have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.”

It had never crossed my mind before that cookie requests would initiate a cookie request and the loads that would go with that request. Needless to say the article is a must read for any web developer.

The same article also mentions CSS & Javascript Minimisers which reduce the file size of CSS & JS by removing unnecessary characters and line breaks. It turns out that Yahoo! has created an excellent tool, the YUI Compressor,  which does just that. This command prompt based program will remove all the unnecessary spaces, line breaks and more from your code and I’ve seen it take nearly a third off a file size. You can even integrate it with your IDE and have it run when you publish your files. For visual studio see these google results.

Enjoy

1 comment for now