...now browsing by category


Do not use VS2005 to edit .Net 1.1 aspx file

Friday, September 28th, 2012

Today, I learned another painful lesson using Visual Studio 2005 to edit a live ASP.Net 1.1 page (.aspx file) – after I made some minor change on html codes and saved it back , the whole site blew up. What happened was that VS2005 automatically inserted a few .net 2.0 assemblies into the web.config file on the live server, even I just pull down a file to local machine and used my VS2005 to edit it.

These are those assemblies that were added by VS2005:

<add assembly=”System.Web, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>
<add assembly=”System.Configuration, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System.Drawing, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A”/>
<add assembly=”System.Xml, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089″/>

Previously I used either VS2003, notepad or VS2008/2010 to edit the same page and never encountered something like this. So this must be some VS2005 specific bug and Microsoft probably realized that it did too much automation in VS2005 and fixed that in later versions of VS.

So never edit a .net 1.1 ASP.Net webpage inside VS2005.  It is fine to use VS2003, VS2008 or VS2010, though.

WCF Service Error: Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https]

Friday, October 7th, 2011

Setup a WCF service this morning and published to IIS6 where it is secured by a server certificate, that is https://localhost:8080/WcfSecured/Demo/DemoService.svc, then I got this confusing and commonly seen error:

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https].

Well, thing was simpler than it portraits – as it turned out, there was a mis-configuration in the binding; I shouldn’t have used such binding for service hosted in SSL:

<binding name=”NoSecure”>
<security mode=”None”>
<transport clientCredentialType=”None”></transport></security>

This is because the WCF service is hosted in a site that requires SSL, and this binding violates the SSL requirement. But the error message is too generic and if not by experimenting, I probably will still be search the web for an answer.

What I did was simply added another binding :

<binding name=”SecureTransportOnly”>

<security mode=”Transport”>

<transport clientCredentialType=”None” />

(it will still work if did not specify clientCredentialType at all)


And have the service end point uses the new binding.

Find that stored proc that drags

Thursday, June 9th, 2011

Today, I read an outstanding article by Gail Shaw at simple-talk.com about the best way to identify the stored proc or t-sql query that is the culprit of a slow performance website. The basic technique, as suggested by the author, is to use SQL Profiler GUI to create the trace definition, focusing on TextData, CPU, write, reads, and duration data columns; run Profiler for a short period and stop, save the trace definition file. Author highly recommended that we should not run Profiler for too long as it will compete for server resource and sometimes can bring the server to a halt.

After trace is run, the results are exported to a table and by querying that table, sorted by CpuImpact, IOImpact, and TimeImpact, we can easily identify the stored proc name that costs most. It was a great writing, very clean and truck load of useful information. Click here to access the part I of the article…

Retrieve dropdown list’s selected text in jQuery

Monday, April 11th, 2011

Often times there is need to access a DropDown list control’s selected text from client side; for example, this server control has a server id “ddlSubject”, how would you access its selected text using jquery? I thought this was trivial, using $(“[id$=’ddlSubject’]”).text() would do, as $(“[id$=’ddlSubject’]”).val() I knew would give me the selected value. Wrong!!. As matter of fact, $(“[id$=’ddlSubject’]”).text() returned all the option texts, not just the selected text.

Well, as it turned out, what’s really working is to use $(“[id$=’ddlSubject’] option:selected”).text();