Inspirations, captions, ideas and notes.

Archive for the ‘Web Development’ Category

Viewing ASP.NET / .ASP pages outside Visual Web Developer

Are you using Windows XP and having problems with viewing your .asp pages via localhost?  If you’re having trouble viewing your ASP.NET / .ASP pages, and can swear that IIS has been installed successfully like I did (hah), perhaps these steps will help you, like they helped me.

I was able to view the .asp site while the debugger in Visual Web Developer 2008 was on and the project was open.  Once the project was closed, or if I was not in Visual Web Developer, I get this error message when trying to view the same site through “http://localhost/sitename/about.aspx”

The page cannot be found…

Page Cannot Be Found

Page Cannot Be Found

It’s possible serving of ASP and ASP.NET pages have been prohibited.  To resolve this,

  1. Click on [Start], select “Run” and you’ll see the Run dialog box open.
  2. Type “inetmgr” and click [OK] to open your Internet Information Services (IIS) Manager.
  3. In the left panel of the IIS Manager, click on [+] next to your computer name, to expand the menu tree.
  4. Click on “Web Service Extensions” to display the list of web service extensions in the right panel.
  5. You will see “Active Server Pages” and “ASP.NET v2.0…” listed in the right panel along with their current status.  Mine were “Prohibited” on both counts.
  6. If the status is “Prohibited”, click on the service you wish to allow, e.g. “Active Server Pages”, and click on the [Allow] button.  This changes the status to “Allowed”.  I selected “allowed” for “ASP.NET v2.0…” as that is what I need.
  7. You should be able to view your .ASP site via “http://localhost/sitename/” by now.

These were the steps I used, and they worked for me.  I hope you’ll find them helpful.  Good luck! 🙂

Addon – 28 May 2009 11:55am

Just to add, if you have completed the steps above and have made some progress but encounter this error:

“Server Error in ‘/’ Application”

Server Error In '/' Application

Server Error In '/' Application

It is possible the site has not been setup properly still. At the IIS manager (see earlier steps for opening the IIS manager and expanding the menu tree), click on [+] for “Application Pools”, and then for “DefaultAppPool”.  If you only see “Default Application” and no other application names that resembles your site name, follow these steps as well:

  1. In the extended menu tree of the IIS Manager, click on [+] “Web Sites” and then [+] “Default Web Site” to reveal the list of sites currently in your wwwroot folder.
  2. Right-click on the site you wish to setup to be viewed in using IIS via “localhost”, e.g. [+] Testsite1, and select “Properties” to open the properties window for your site.
  3. The Properties window has several tabs, namely, Directory, Documents, etc.  Make sure the “Directory” tab is selected.  If the Application name label and text field is greyed out, click on [Create] next to it.  The label and text field is no longer grayed out and your sitename (e.g. Testsite1) appears in the text field.
  4. Click on [OK] to confirm and close the site properties window.
  5. Now, you should be able to view your site using the “localhost” url through your internt browser. E.g. http://localhost/Testsite1/Default.aspx

Once again, these steps worked for me, I hope they work for you too.  Feel free to drop me a note if you wish to add or suggest anything.


List of development resource

I keep coming across interesting development, coding or javascript sites but have not jotted them down… only to have trouble finding them again when I need them later. Sigh… yup, so here is a list, in no particular order. I’ll update this post as I go along…

Web Development


Trapping malicious codes in your cfm sites

I came across this sometime ago, but complete forgot about it. If you are looking for ways to trap malicious codes in your cfm sites, have a look at this:

Function isHackAttempt(MaliciousCode) {
//Set the Regular Expression used and any local vars
Var strRegex = "(%)|(-- )|(' )|(script)|()|(%3c)|(%3e)|(script)|(SELECT)|(UPDATE) |(INSERT) |(DELETE) |(DROP)|(GRANT) |(REVOKE)|(UNION)|(<)|(>)";
Var blnCodeDetection = False;

//If argument is a Structure loop through it
If (IsStruct(MaliciousCode)) {
For (Field in MaliciousCode) {
If (REFindNoCase(strRegex, MaliciousCode[Field])) {
blnCodeDetection = True; //Malicious code was found, set flag var
}//If argument is an Array loop through it
} Else If (IsArray(MaliciousCode)) {
For (x = 1; x LTE ArrayLen(MaliciousCode); x = x + 1) {
If (REFindNoCase(strRegex, MaliciousCode[x])) {
blnCodeDetection = True; //Malicious code was found, set flag var
}//If none of the above its an individual variable
} Else {
If (REFindNoCase(strRegex, MaliciousCode[Field])) {
blnCodeDetection = True; //Malicious code was found, set flag var
Return blnCodeDetection; //Return the boolean result

Then all you need to do is figure out what you want to do with the errors that have been trapped – e.g. if isHackAttempt is true, display an error message.

Place the above code in your application.cfm and customise according to your specific needs.

Follow-up on coldfusion jrun server problem

Here’s the final update. Sorry it took so long. Having isolated the problem and put in a quick fix through rectification of the database entries, we needed time to run through our codes to locate the point(s) of failure.

Turns out, the error was not caused by Coldfusion after all. We have a piece of code in our application which generates the breadcrumb which flag to users their current location on the site. Unfortunately, the code did not cater for adnormal situations.

An example of such would be when a child page (which exists), is related to a parent page which doesn’t. This is what happened.

During our troubleshooting:

  • We walked through the database entries to identify any corrupted or errornous data, and didn’t find any.
  • We also checked for possible updates applicable to the web server, application server and jrun, but decided to implement this if all else failed.
  • Various server settings were changed to improve the system performance, but this didn’t solve the problem.

There has not been any changes to the application since 2005.

It seemed the application ended up in a loop still looking for a parent which its never able to find. Yup, we didn’t see this coming at all, as each time a child page is added, we would relate it with a parent which exists…

Unfortunately there is a hardcoded value within one of the pages which contributed to this error. That page references a hardcoded url. And although that page exists, it didn’t have a parent associated with it in this particular site. (The page is shared across our sites).

So it’s down to the nitty gritty. Janice helped me to search for the fault and finally able to locate it after sifting through our various .cfc and .cfm codes, doing dry runs based on the faulty data.

durr… So this is ultimately a case of human error. But that is no excuse, so we have added in the check into the application. Well, we live and learn.

The upside is, our application now handles the anomoly, it was a good learning experience for the team as we have never tweaked any of our coldfusion server settings before, and we are all aware of possible problems that can arise from the settings plus our current server capacity.

Still having jrun error…

The setting changes didn’t help, so Nithi has helped to put in the min and max java heap size setting in Coldfusion to 512 and 756.  This seems to have helped stabilise the high CPU hogging by jrun from a constant of 98%-100% to 80%-90%.  However, we feel the cpu utilisation shouldn’t be so high.

To get the version and vendor information from the JRE on our server, we used this link:

Java Version 1.5.0_12 from Sun Microsystems Inc.

Then, from a reference table on the same page, the site informs that our version is the latest version as of Dec 2005!

Next, we looked at the system error logs to see if there’s anything else we can find.  Lots of exceptions and it seems the warnings and exceptions have been there since a long time ago.  To me, its and indication that we need to look into this, but this may not be our immediate concern.

Mark Kruger ( suggests that log file size could contribute to system slow performance.  He suggests that attributes in jrun.xml can be used to rotate the log files more efficiently, preventing them from getting too big:

<service class="jrunx.logger.LoggerService" name="LoggerService">
<attribute name="filename">{jrun.rootdir}/logs/{}-event.log</attribute>

Can be changed to:

<attribute name="filename">{jrun.rootdir}/logs/{}-{log.level}.log</attribute>

Only problem is… it doesn’t work for the -err file.


‘Jrun closed connection’ error on Coldfusion

Our coldfusion server has been getting this error since Thursday and last night, we arranged for a backup server as a fallback should the main one fail. With 2.5 gb in the backup server, we decided to promote it as a main server instead.

This morning, we checked the site again, and found that our problem is still there.

Suggested solutions:

Related information:

Unit Testing