I had found with ASP.NET 2.0 beta 1, that it converted all my websites hosted on my server to .NET 2.0 – even though they were developed in .NET 1.1, this didn’t cause too many problems, since .NET 2.0 is very much backwards compatible with .NET 1.1. After installing .NET 2.0 beta 2, it reverted all my websites back to .NET 1.1, even though some were developed in .NET 2.0, thus crashing some websites, such as www.downloadsoft-ware.co.uk
There is the IIS MMC snap in that is supposed to toggle versions, (under properties / ASP.NET) but it never worked under Beta 1, and in Beta 2, it was nowhere to be seen!
After hunting on the web for a solution, I found this blog http://dotnet.org.za/ahmeds/archive/2005/04/26/19028.aspx?Pending=true which recomended "Microsoft comments: If a previous version was not uninstalled correctly, please regedit eliminate all versions except 184.108.40.206 in the following locations:
I did this, and the website crashed with a "Server Application unavailable". I rebooted the server, toggled the site back to .NET 1.1 then back to .NET 2.0 and it worked!
After upgrading my server from ASP.NET 2.0 Beta 1 to ASP.NET 2.0 beta 2, I found, to my horror, it could no longer connect to my SQL server 2005 database – with an "Access is denied" error.
However, I found out that I can use an OLEDB connection string thus
Persist Security Info=False;
Initial Catalog=<your database>;
Use Procedure for Prepare=1;
Use Encryption for Data=False;
Tag with column collation when possible=False;
— Not the prettiest thing in the world, but it works!
I recently set about writing some code to download a file named pf.csv.gz – which was GZIP’ed and creating the corresponding CSV file on disk. Using the ICSharpCode Zip compression library, I used this code:
string strCSVFile = "c:\pf.csv";
string strUrl = "http://www.someurl.com/pf.csv.gz";
WebClient wc = new WebClient();
Byte bZip = wc.DownloadData(strUrl);
MemoryStream msZip = new MemoryStream(bZip);
GZipInputStream gzisZip = new GZipInputStream(msZip);
FileStream fsOutput = new FileStream(strCSVFile,FileMode.Create);
Byte bCSV = new Byte[Byte.MaxValue];
Int32 iReadCount = Byte.MaxValue;
iReadCount = gzisZip.Read(bCSV,0,iReadCount);
A tip I just learned this morning, if you need a website to appear different when it prints, you can add a CSS style that is only applied during printing. – For instance, if you wanted to strip off menus, or remove certain graphics, you could use display:none in the printer css style.
The trick to it is to use this format to include your CSS
<style type="text/css" media="screen">@import "screen.css";</style>
<style type="text/css" media="print">@import "print.css";</style>
On a personal note, I just noticed that one of my domains has either not been listed or removed from google http://www.listofestateagents.info, which was a bit of a pity. For some reason over the last week my Page impressions have gone down, but my CTR has gone up. Net result being that revenue took a hit. But I guess that means that at least google is targeting my pages better.
Chatrooms are typically developed in Flash or java, since they both contain the facility to make HTTP requests to the server from which the Applet / SWF was downloaded from. An ActiveX control named Microsoft.XMLHTTP also has the same capability, and is capable of running on browsers with default security settings (I believe it may be marked ‘safe for scripting’). I also believe that it is compatible with FireFox, and IE7 are relaxing security for this specific control.
So, I decided to put together a simple chatroom example in asp.net using this technology. Based on an excellent example by Dino Esposito.
Starting off with a simple html form thus:
<h1>Demonstrate Simple chatroom with Out-of-band Calls</h1>
Message: <input type="text" name="txtMessage">
<Button Runat="server" ID="ButtonGo">Send & Receive</Button>
<span ID="Msg" />
function DoCallback(url, params)
var pageUrl = url + "?callback=true¶m=" + params;
var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
xmlRequest.open("POST", pageUrl, false);
var xmlRequest = DoCallback("callback.aspx", message);
Msg.innerHTML = xmlRequest.responseText;
if (message==”) setTimeout("Callback(”)",2000);
As we can see, a post request is sent back to callback.aspx, which handles the request thus:
private void Page_Load(object sender, EventArgs e)
if (Request.QueryString["callback"] != null)
string param = Request.QueryString["param"].ToString();
string callbackRef = "Callback(document.all[‘txtMessage’].value)";
ButtonGo.Attributes["onclick"] = callbackRef;
string RaiseCallbackEvent(string eventArgument)
Application["conversation"] += eventArgument + "<br>";
Pretty simple. To check out a demo see www.globefinder.info/callback.aspx
A colleague of mine recently had his website hacked with a sql injection attack, with a url something like http://www.someurl.com/somepage.asp?
hense exposing all the usernames and passwords on the page. it lead me to think, how did the hacker guess the column names? – I knew about the sysobjects table in sql server, but being a classic ASP page, it would undoubtedly have an Access back end. Then I spotted the following hidden tables in access:
Which you can query to obtain the database schema. All I can say is . NEVER EVER BUILD SQL STATEMENTS DIRECTLY WITH USER PROVIDED TEXT (without calling Replace("’","”") at least!
AppName: vb6.exe AppVer: 220.127.116.11 ModName: oleaut32.dll
ModVer: 5.1.2600.2180 Offset: 00004c47
Unhandled exception at 0x77124c47 in VB6.EXE: 0xC0000005: Access violation reading location 0x80020000.
77124C47 mov eax,dword ptr [eax-4]
This is a lovely error that crashes VB6 if you make a little typo, and here’s how to fix it:
If you make write code like this
Dim rsProduct As New ADODB.Recordset
sql = " select * from orderlines "
rsOrderLines.Open sql, DSN
Do While Not rsProduct
‘ process rsProduct
The application will compile, But, note that I have accidentaly ommitted the ".EOF" in the while loop. This causes VB6 to crash with the above error. To Fix it, use the EOF.