Remove JavaScript Tags From HTML

After a while of trying to create the perfect regular expression that would remove script tags from HTML I came across this super simple regular expression. It goes to show you, sometimes the simplest things work best.

s = Regex.Replace(s, "", "",RegexOptions.Singleline|RegexOptions.IgnoreCase);

Source: http://forums.asp.net/t/1323604.aspx/1

Looping Through a Directory And Its Files

A simple function to sift through all the files in a directory using .net

Private Function getEntries(ByVal dir As String)
Dim strEntry As String
Dim dirInfo As New DirectoryInfo(dir)
Dim strEntries As String() = Directory.GetFileSystemEntries(dirInfo.FullName)
     For Each strEntry In strEntries
          If (Directory.Exists(strEntry)) Then
               getEntries(strEntry)
          Else
               Response.Write(strEntry.ToString())
            End If
     Next
Return 0
End Function

Applying Simple Ajax Functionality On Visual Studio

Here are the simple steps to applying ajax functionality to an aspx page using the UpdatePanel control.

  1. Drag and drop a ScriptManager item from the Ajax Extensions section on the toolbox onto the form you wish to add Ajax to.
  2. Drag and drop an UpdatePanel from the Ajax Extensions section on the toolbox onto the form you wish to add Ajax to.
  3. Drag and drop your form controls to the inside of the UpdatePanel.

It’s as simple as that. Here is what the code should look like on the Default.aspx page.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label>
                <br />
                <asp:TextBox ID="txtMessage" runat="server"></asp:TextBox>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

And here is what the code-behind page (Default.aspx.vb) should look like. Keep in mind this is a very simple example.

Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Me.lblMessage.Text = Me.txtMessage.Text
    End Sub
End Class

File Funnel

File Funnel is a small application I made that copies files of a specific extension from one directory and its sub-directories to another. It gives you the option to either copy just the files or the directory structure as well.

*It is built on VB.NET and requires the Microsoft .NET Framework so an additional download might be necessary. The application will direct you to the Microsoft download site for that.

Source @ GIT: https://github.com/cquinterox/File-Funnel