Tuesday, August 11, 2009

Counting code lines in .NET Visual Studio project

I recently found a really useful tool to count the number of lines in a c# or vb.net project or solution.

The tool is available for free download at the following URL:

http://richnewman.wordpress.com/2007/07/09/c-visual-basic-and-c-net-line-count-utility-version-2/

Wednesday, March 11, 2009

WCF error: "This collection already contains an address with scheme http"

WCF error: "This collection already contains an address with scheme http".

The explanation is that "WCF services hosted in IIS can have only one Base Address".

Easy fix:

Just add the following lines in the system.serviceModel section:

<serviceHostingEnvironment>

<baseAddressPrefixFilters>

<add prefix="http://www.example.com"/>

</baseAddressPrefixFilters>

</serviceHostingEnvironment>


Tuesday, February 17, 2009

Redirect a page URL in javascript

The following code will redirect a page from index.aspx to the root URL in javascript:

var u = 'http://www.mysite.com/';
if (self.parent.frames.length != 0) self.parent.location=u;
if (self.location != u) self.location=u;//

Monday, February 16, 2009

301 Redirect in ASP.NET / C# Code

If you want to redirect a URL on a permanent basis using ASP.NET and C# code as an alternative to using IIS 6 or IIS 7, you can append the code to the old ASP.NET page.


Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "http://www.newpagelocation.com/");
Response.End();

Hope this helps!

Friday, January 23, 2009

File Access Error .IPX IPIX 360 FILES

If you encounter an error with the message "file access error" when serving IPIX files via a windows server and IIS it is likely that:

1) Your browser has no java support (in this case you will NOT see the IPIX logo)
2) Your IIS Server is not configured to serve these files:

i) Right click the website in IIS > Properties

ii) Select the HTTP headers button

iii) Add a new MIME type with a .IPX extension and MIME type of application/x-ipx

Hope this helps someone - it drove me mad for 2 hours!