1. Now for this one I got hold of one of the dictionary files from a dictionary attack and converted into an access DB.

2. Then went ahead and built an AJAX enabled website using VS 2005.

3. Added up a TextBox and an AutoCompleteExtender.

4. Add an AutoComplete page method from the tasks.

Code of the .aspx page:

<form id="form1" runat="server">        
<asp:ScriptManager ID="ScriptManager1" runat="server" />        
<div>            
Automatically generating words for a textbox using asp.net ajax:
<br />            
<br />            
<asp:TextBox ID="TextBox1" runat="server" Width="372px"></asp:TextBox><br />            
<br />            
<cc1:AutoCompleteExtender TargetControlID="TextBox1" MinimumPrefixLength="1" ID="AutoCompleteExtender1" runat="server" ServiceMethod="GetCompletionList"                
UseContextKey="True">            
</cc1:AutoCompleteExtender>        
</div>    
</form>


4. Added up the following code in the .cs file where in I am doing a simple query and calling up the web service method.

public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
if (count == 0){count = 10;}string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\\Users\\abbas\\Desktop\\site1\\App_Data\\db01.mdb'";
OleDbConnection conn = new OleDbConnection(connString);string sql = "SELECT [Desc]FROM Table1 WHERE Desc LIKE (@value + '%')";
OleDbCommand myCmd = new OleDbCommand(sql, conn);
myCmd.Parameters.Add(new OleDbParameter("@value", System.Data.SqlDbType.Text));
conn.Open();myCmd.Parameters["@value"].Value = prefixText.ToString();
OleDbDataReader reader = myCmd.ExecuteReader();int i = 0;
ArrayList arrNames = new ArrayList();while (reader.Read() && i < 20){arrNames.Add(reader[0].ToString());i++;
}
conn.Close();
return (string[])(arrNames.ToArray(connString.GetType()));}


And here it goes. I just kept the number of results to 20.





(for the DB. Download a dictionary wordlist. Create a Db with one table and import the data. There you go. If you need the DB or the wordlist just email me)