Flash CS5.5 and AS3 – Flash (AS3) / ASHX (ASP.Net) / SQL Server – Post

This article explains in the most simpliest terms how to use action script to connect to SQL Server via an ashx file in order to post data from your flash application.

First, you build a flash game that keeps track of the gamer’s score. At the end of the game, you want to save the gamer’s score to your database.

To save the score, you need to add code to your action script to call an ashx file on your server.

First, define a URLVariables variable. Appended to this variable are the game statistics that you want to pass to your ashx file. (PlayerName, PlayerLevel, PlayerScore)

Second, you define a URLLoader variable.

Next, define a URLRequest variable that contains the url location of your ashx file. You then assign the POST method to your URLRequest variable and assign your defined variables to it’s data method.

Lastly, you assign the TEXT data format to your URLLoader, then execute the load method of the URLLoader passing as a parameter the URLRequest variable.

Below is the code:

var variables:URLVariables = new URLVariables;
variables.PlayerName = txtPlayerName.text;
variables.PlayerLevel = txtPlayerLevel.text;
variables.PlayerScore = txtPlayerScore.text;

var varLoaderPost:URLLoader = new URLLoader;

var varSend:URLRequest = new URLRequest("http://www.somewebsite.com/flash/somefile_POST.ashx");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

varLoaderPost.dataFormat = URLLoaderDataFormat.TEXT;
varLoaderPost.load(varSend);

Now that the action script code is explained, let’s talk about the ashx file that gets called by your flash application.

First, you receive the player name, level, and score posted to the ashx and assign them to variables.

Second, you establish your timezone of choice and get the current date.

Third, you open up your database connection.

Next, you build the insert sql statement.

Lastly, you execute the sql statement. The player’s data is now stored in the database.

The ashx finishes off by closing your database connection.

Below is the code:

somefile_POST.ashx

<%@ WebHandler Language="VB" Class="somefile_POST" %>

Imports System.Data.SqlClient
Imports System.Data
Imports System.Text

Public Class somefile_POST : Implements IHttpHandler
    Protected mLogger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger

    Protected mDatabaseServer As String = String.Empty
    Protected mDataBase As String = String.Empty
    Protected mDatabaseUserID As String = String.Empty
    Protected mDatabasePassword As String = String.Empty
    Protected mSQLConnection As New SqlConnections
    Protected mSQLCommand As New SqlCommand

    Protected PlayerName As String = String.Empty
    Protected PlayerScore As String = String.Empty
    Protected PlayerLevel As String = String.Empty
   
    Protected _CurrentDateTime As DateTime = Nothing
    
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Try
            PlayerName = Trim(context.Request.Form("PlayerName"))
            PlayerScore = Trim(context.Request.Form("PlayerScore"))
            PlayerLevel = Trim(context.Request.Form("PlayerLevel"))

            Dim timeZoneInfo__1 As TimeZoneInfo
            'Set the time zone information to US Mountain Standard Time 
            timeZoneInfo__1 = TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time")
            'Get date and time in US Eastern Standard Time 
            _CurrentDateTime = TimeZoneInfo.ConvertTime(DateTime.Now, timeZoneInfo__1)
            'Print out the date and time

            OpenDatabaseConnection()

            ToDataBase()

            CloseDatabaseConnection()

        Catch ex As Exception
            mLogger.Error(ex.Message)
        End Try
    End Sub
    
    Protected Sub OpenDatabaseConnection()
        Try
            mDatabaseServer = "your.database.server"
            mDataBase = "yourdatabasename"
            mDatabaseUserID = "userid"
            mDatabasePassword = "password"

            mSQLConnection.ConnectionString = "Data Source=" & mDatabaseServer & ";Initial Catalog=" & mDataBase & ";Persist Security Info=True;User ID=" & mDatabaseUserID & ";Password=" & mDatabasePassword
            mSQLConnection.Open()
            mSQLCommand.Connection = mSQLConnection

        Catch ex As Exception
            mLogger.Error(ex)
        End Try
    End Sub

    Protected Sub CloseDatabaseConnection()
        Try
            mSQLConnection.Close()
        Catch ex As Exception
            mLogger.Error(ex)
        End Try
    End Sub

    Protected Sub ToDataBase()
        Dim mString As New StringBuilder
        Try
            Dim mReplaceString As String = String.Empty

            mString.Append("INSERT INTO flash_game_table")
            mString.Append("(DatePlayed, PlayerName, PlayerLevel, PlayerScore) ")
            mString.Append("VALUES (")

            mString.Append("'")
            mString.Append(_CurrentDateTime)
            mString.Append("'")
            mString.Append(", ")

            mString.Append("'")
            mString.Append(PlayerName)
            mString.Append("'")
            mString.Append(", ")

            mString.Append("'")
            mString.Append(PlayerLevel)
            mString.Append("'")
            mString.Append(", ")

            mString.Append("'")
            mString.Append(PlayerScore)
            mString.Append("'")

            mString.Append(")")

            mSQLCommand.CommandText = mString.ToString
            mSQLCommand.ExecuteNonQuery()

        Catch ex As Exception
            mLogger.Error(ex)
            mLogger.Error("SQL Statement: " & mString.ToString)
        End Try
    End Sub
 
    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property

End Class

Flash CS5.5 and AS3 – Flash (AS3) / ASHX (ASP.Net) / SQL Server – Get

This article explains in the most simpliest terms how to use action script to connect to SQL Server via an ashx (ASP.Net) file in order to extract data for display in your flash application.

First, you build a flash game that keeps track and stores the gamer’s score. Before we even discuss that (in another article: http://www.jamesandchey.net/?p=543),
we want to retrieve the top score from the database saved from a previous game and display it to the current gamer.

To retreive the top score, you need to add code to your action script to call an ashx file on your server.

First, define a URLLoader variable.

Next, define a URLRequest variable that contains the url location of your ashx file. Also, assign the GET method to your URLRequest variable.

You then need to define an event listener to your URLLoader so it can fire a function (that you define) once the data is returned to your flash application via the ashx file.
The function you define will take the data (built in XML format by the ashx file) and load it into textbox variables for display.

Lastly, execute the load method of the URLLoader passing as a parameter the URLRequest variable.

Below is the code:

var varLoaderGet:URLLoader = new URLLoader;
var varGet:URLRequest = new URLRequest("http://www.somewebsite.com/flash/somefile_GET.ashx");
varGet.method = URLRequestMethod.GET;

varLoaderGet.addEventListener(Event.COMPLETE, loaderGetCompleteHandler, false, 0, true);
varLoaderGet.load(varGet);

function loaderGetCompleteHandler(e:Event):void
{
	var dataXML:XML = XML(e.target.data);
	_SQLDatePlayed.text = (dataXML.item[0]);
	_SQLName.text = (dataXML.item[1]);
	_SQLLevel.text = (dataXML.item[2]);
	_SQLScore.text = (dataXML.item[3]);
}

Now that the action script code is explained, let’s talk about the ashx file that gets called by your flash application.

The first part of your ashx file connects to SQL Server and establishes a connection to your database.

Next, you build your query statement to retrieve the data.

Lastly, you execute the query and store the results in your DataTable.

Now that you have the data, you build the xml file using XmlTextWriter.

The ashx finishes off by writing out the XML to be retrieved by your flash application.

Below is the code:

somefile_GET.ashx

<%@ WebHandler Language="VB" Class="somefile_GET" %>

Imports System
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data
Imports System.Text
Imports System.Xml
Imports System.IO

Public Class somefile_GET : Implements IHttpHandler
    Protected mSQLDataReader As SqlDataReader
    Protected somefileSchemaTable As DataTable
    Protected somefileDataTable As DataTable

    Protected mDatabaseServer As String = String.Empty
    Protected mDataBase As String = String.Empty
    Protected mDatabaseUserID As String = String.Empty
    Protected mDatabasePassword As String = String.Empty
    Protected mSQLConnection As New SqlConnection
    Protected mSQLCommand As New SqlCommand
          
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

        OpenDatabaseConnection()
        
        Dim mString As New StringBuilder

        mString.Append("SELECT top 1 * FROM flash_game_table order by PlayerScore desc, DatePlayed desc")

        mSQLCommand.CommandText = mString.ToString
        mSQLDataReader = mSQLCommand.ExecuteReader()

        If mSQLDataReader.HasRows = True Then
            DataReaderToDataTable()
        End If

        mSQLDataReader.Close()
        
        CloseDatabaseConnection()
        
        Dim somefile As New System.IO.MemoryStream
        Dim writer As New XmlTextWriter(somefile, System.Text.Encoding.UTF8)
        writer.WriteStartDocument(True)
        writer.Formatting = Formatting.Indented
        writer.Indentation = 2
        writer.WriteStartElement("flash_game")
        
        For Each pRow As DataRow In somefileDataTable.Rows
            Dim mDatePlayed As String = String.Empty
            Dim mPlayerName As String = String.Empty
            Dim mPlayerLevel As String = String.Empty
            Dim mPlayerScore As String = String.Empty
            For Each pColumn As DataColumn In somefileDataTable.Columns
                Select Case pColumn.Caption
                    Case "DatePlayed"
                        mDatePlayed = pRow(pColumn)
                    Case "PlayerName"
                        mPlayerName = pRow(pColumn).ToString
                    Case "PlayerLevel"
                        mPlayerLevel = pRow(pColumn).ToString
                    Case "PlayerScore"
                        mPlayerScore = pRow(pColumn).ToString
                End Select
            Next
			
            writer.WriteStartElement("item")
            writer.WriteString(mDatePlayed)
            writer.WriteEndElement()
			
            writer.WriteStartElement("item")
            writer.WriteString(mPlayerName)
            writer.WriteEndElement()
			
            writer.WriteStartElement("item")
            writer.WriteString(mPlayerLevel)
            writer.WriteEndElement()
			
            writer.WriteStartElement("item")
            writer.WriteString(mPlayerScore)
            writer.WriteEndElement()
        Next
                
        writer.WriteEndElement()
        writer.WriteEndDocument()
        writer.Flush()
        
        'This is so I can see the xml that I am actually building. 'writer' is what I will be sending to my flash program.
        Dim _somefileXML As String = Encoding.UTF8.GetString(somefile.GetBuffer(), 0, CInt(somefile.Length))
      
        context.Response.ClearContent()
        context.Response.Clear()

        context.Response.ContentType = "text/xml"
        context.Response.OutputStream.Write(somefile.ToArray(), 0, somefile.Length)
        context.Response.Flush()
        writer.Close()
    End Sub
 
    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property
    
    Protected Sub OpenDatabaseConnection()
        Try
            mDatabaseServer = "your.database.server"
            mDataBase = "yourdatabasename"
            mDatabaseUserID = "userid"
            mDatabasePassword = "passwrod"

            mSQLConnection.ConnectionString = "Data Source=" & mDatabaseServer & ";Initial Catalog=" & mDataBase & ";Persist Security Info=True;User ID=" & mDatabaseUserID & ";Password=" & mDatabasePassword
            mSQLConnection.Open()
            mSQLCommand.Connection = mSQLConnection

        Catch ex As Exception

        End Try
    End Sub
    
    Protected Sub CloseDatabaseConnection()
        Try
            mSQLConnection.Close()
        Catch ex As Exception

        End Try
    End Sub
    
    Protected Sub DataReaderToDataTable()
        'This function receives a Data Reader and returns a Data Table
        Try
            'Table Schema
            somefileSchemaTable = mSQLDataReader.GetSchemaTable()
            'Data Table
            somefileDataTable = New DataTable
            Dim intCounter As Integer
            'Now to create the Schema on the DataTable
            For intCounter = 0 To somefileSchemaTable.Rows.Count - 1
                'Current Row
                Dim dataRow As DataRow = somefileSchemaTable.Rows(intCounter)
                'Current Column Name
                Dim columnName As String = CType(dataRow("ColumnName"), String)
                'Current Column
                Dim column As New DataColumn(columnName, CType(dataRow("DataType"), Type))
                'Add Column to the DataTable
                somefileDataTable.Columns.Add(column)
            Next intCounter
            'Now to fill the table with the reader
            While mSQLDataReader.Read()
                'New Row
                Dim dataRow As DataRow = somefileDataTable.NewRow()
                'Loop the fields
                For intCounter = 0 To mSQLDataReader.FieldCount - 1
                    'Insert the current value of the DataReader to the DataRow
                    dataRow(intCounter) = mSQLDataReader.GetValue(intCounter)
                Next
                'Insert the Row into the DataTable
                somefileDataTable.Rows.Add(dataRow)
            End While
        Catch ex As Exception

        End Try
    End Sub
End Class

Flash CS5.5 and AS3 – Flash (AS3) / PHP / MySQL – Post

This article explains in the most simpliest terms how to use action script to connect to MySQL via a php file in order to post data from your flash application.

First, you build a flash game that keeps track of the gamer’s score. At the end of the game, you want to save the gamer’s score to your database.

To save the score, you need to add code to your action script to call a php file on your server.

First, define a URLVariables variable. Appended to this variable are the game statistics that you want to pass to your php file. (PlayerName, PlayerScore)

Second, you define a URLLoader variable.

Next, define a URLRequest variable that contains the url location of your php file. You then assign the POST method to your URLRequest variable and assign your defined variables to it’s data method.

Lastly, you assign the TEXT data format to your URLLoader, then execute the load method of the URLLoader passing as a parameter the URLRequest variable.

Below is the code:

var variables:URLVariables = new URLVariables;
variables.PlayerName = txtPlayerName.text;
variables.PlayerScore = txtPlayerScore.text;

var varLoaderPost:URLLoader = new URLLoader;

var varSend:URLRequest = new URLRequest("http://www.somewebsite.com/flash/somefile_POST.php");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

varLoaderPost.dataFormat = URLLoaderDataFormat.TEXT;
varLoaderPost.load(varSend);

Now that the action script code is explained, let’s talk about the php file that gets called by your flash application.

The first part of your php file connects to MySQL and establishes the database name.

Second, you receive the player name and player score posted to the php and assign them to php variables.

Third, you get the current date. (The time zone is set at the beginning of the php file to whatever time zone you prefer)

Next, you build the insert sql statement.

Lastly, you execute the sql statement. The player’s data is now stored in the database.

The php finishes off by closing your database connection.

Below is the code:

somefile_POST.php

<?PHP
date_default_timezone_set('EST');

$link = mysql_connect("localhost", "username", "password");
mysql_select_db("flash_database") or die ("no database");

$PlayerName = $_POST['PlayerName'];
$PlayerScore = $_POST['PlayerScore'];

// Get the current date
$current_date = date('Y-m-d H:i:s');

$sqlCommand = "INSERT INTO flash_game_table (date_played, name, score)
               VALUES('$current_date ', '$PlayerName', '$PlayerScore')";

$results = mysql_query($sqlCommand) or die (mysql_error());

mysql_close($link);

?>

Flash CS5.5 and AS3 – Flash (AS3) / PHP / MySQL – Get

This article explains in the most simpliest terms how to use action script to connect to MySQL via a php file in order to extract data for display in your flash application.

First, you build a flash game that keeps track and stores the gamer’s score. Before we even discuss that (in another article: http://www.jamesandchey.net/?p=530),
we want to retrieve the top score from the database saved from a previous game and display it to the current gamer.

To retreive the top score, you need to add code to your action script to call a php file on your server.

First, define a URLLoader variable.

Next, define a URLRequest variable that contains the url location of your php file. Also, assign the GET method to your URLRequest variable.

You then need to define an event listener to your URLLoader so it can fire a function (that your define) once the data is returned to your flash application via the php file.
The function you define will take the data (built in XML format by the php file) and load it into textbox variables for display.

Lastly, execute the load method of the URLLoader passing as a parameter the URLRequest variable.

Below is the code:

var varLoaderGet:URLLoader = new URLLoader;
var varGet:URLRequest = new URLRequest("http://www.somewebsite.com/flash/somefile_GET.php");
varGet.method = URLRequestMethod.GET;

varLoaderGet.addEventListener(Event.COMPLETE, loaderGetCompleteHandler, false, 0, true);
varLoaderGet.load(varGet);

function loaderGetCompleteHandler(e:Event):void
{
	var dataXML:XML = XML(e.target.data);
	_SQLDatePlayed.text = (dataXML.item[0]);
	_SQLName.text = (dataXML.item[1]);
	_SQLLevel.text = (dataXML.item[2]);
	_SQLScore.text = (dataXML.item[3]);
}

Now that the action script code is explained, let’s talk about the php file that gets called by your flash application.

The first part of your php file connects to MySQL and establishes the database name.

Next, you build your query statement to retrieve the data.

Lastly, you execute the query and store the results in your result string.

Now that you have the data, you build the xml file using the echo statement.

The php finishes off by closing your database connection.

Below is the code:

somefile_GET.php

<?PHP

$link = mysql_connect("localhost", "userid", "password");
mysql_select_db("flash_database");

$query = 'SELECT * FROM flash_game_table order by score desc, date_played desc LIMIT 1';
$results = mysql_query($query);

echo "n";
echo "n";

while($line = mysql_fetch_assoc($results)) {
   echo "" . $line["date_played"] . "n";
   echo "" . $line["name"] . "n";
   echo "" . $line["level"] . "n";
   echo "" . $line["score"] . "n";
}

echo "n";

mysql_close($link);

?>

SQL Server – Concatenate a column of multiple data rows into one generated column

Let’s say you have a table called ‘car_make’ and another table called ‘car_model’. There is a one to many relationship between make and model. You want to bring back a result set of all makes, 1 row per make, but you want only 1 generated column for model that has all the models concatenate into that 1 column. Let’s say you have 4 models for your 1 make of Chevy. Here is the output of what you are striving for:

Make   Model

Chevy   Astro, Beretta, Blazer, Caprice

The following SQL will give you this result:

SELECT make, make_description, 
        (SELECT DISTINCT SUBSTRING
           (replace(replace((
             SELECT DISTINCT m1.model 
           FROM car_make AS m1 
           WHERE a.make = m1.make 
           ORDER BY m1.model 
              FOR XML PATH('')), 
                '</model>',', '),
                  '<model>','') ,1,2000) AS Models 
         FROM car_model) AS ModelsConcat 
     FROM car_make a

If you don’t want the XML type result and instead want just a comma delimited result, then:

SELECT make, make_description,
 (SELECT DISTINCT SUBSTRING((SELECT DISTINCT (m1.model + ', ')
   FROM car_make AS m1
   WHERE a.make = m1.make
   ORDER BY (m1.model + ', ') FOR XML PATH('')) ,1,2000) AS Models 
 FROM car_model) AS ModelsConcat 
 FROM car_make a

If you are adding carriage control to your data, you can add the following ‘type’ method to prevent unfriendly XML characters like this:

SELECT make, make_description,
 (SELECT DISTINCT SUBSTRING((SELECT DISTINCT (m1.model + ', ' + + char(13))
   FROM car_make AS m1
   WHERE a.make = m1.make
   ORDER BY (m1.model + ', ' + char(13)) For Xml Path(''), type).value('.', 'nvarchar(max)') ,1,2000) AS Models 
 FROM car_model) AS ModelsConcat 
 FROM car_make a

If you need to qualify the data that builds the delimited string such as not including null, you can instead put the statement in an outer apply instead of a select statement.

SELECT make, make_description, ModelsConcat.Models
  FROM car_make a
  OUTER APPLY (select distinct SUBSTRING((select distinct (m1.model + ', ')
               from car_make As m1
              where (m1.make = a.make) 
           order by (m1.model + ', ') FOR XML PATH('')) ,1,2000) 
                  AS Models from car_model) as ModelsConcat
 Where ModelsConcat.Models is not null

 

SQL Server – How to get First and Last day of current and previous month without time

Get first day of current month
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0) AS FirstDayOfCurrentMonth

Get last day of current month
SELECT DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) +1, -1) AS LastDayOfCurrentMonth

Get first day of previous month
SELECT DATEADD(month, DATEDIFF(month, 0, GETDATE())-1, 0) AS FirstDayOfPreviousMonth

Get last day of previous month
SELECT DATEADD(mm, DATEDIFF(mm, 0, GETDATE()), -1) AS LastDayOfPreviousMonth

Get first day of month last year
SELECT DATEADD(yyyy, -1, DATEADD(month, DATEDIFF(month, 0, GetDate()), 0)) AS FirstDayOfMonthLastYear

Get last day of month last year
SELECT DATEADD(yyyy, -1, DATEADD(mm, DATEDIFF(mm, -1, GETDATE()), -1)) AS LastDayOfMonthLastYear

Microsoft Visual Studio 2010 – How to add recaptcha and have it work with Microsoft’s CreateUserWizard

Let’s say you create a web site, and you want to add recaptcha to the aspx page where clients can sign up for an account. Instead of a custom sign up form, you instead use Microsoft’s CreateUserWizard control. I’ll explain how you can use both the CreateUserWizard and recpatcha controls effectively.

First, go to the recpatcha web site, follow the online instructions to create an account and retrieve your public and private keys, then download the recpatcha dll library and place them in your bin folder of your web site project. Next, add a reference to the Recaptcha.dll
http://www.google.com/recaptcha

On the same aspx page that hosts the CreateUserWizard, enter the following in the source for the recaptcha control.

<recaptcha:RecaptchaControlID="recaptcha"runat="server"PublicKey="your public key" PrivateKey="your private key"Theme="clean"/>

Since you will not be using a submit button for your recaptcha control, you will instead validate the text entered in the recpatcha control on the server side within your CreateUserWizard_CreatingUser event as follows:

If Page.IsPostBack Then
   recaptcha.Validate()
   If recaptcha.IsValid = False Then
      e.Cancel = True
      lblResult.Text = "Text does not match RECAPTCHA. Please try again."
   End If
Else
   lblResult.Text = String.Empty
   lblResult.Visible = True
End If

Note: recaptcha.Validate() is a method within the recaptcha.dll that will compare the text entered and the text image. If the recaptcha.isValid = False, setting e.Cancel = True stops the CreateUserWizard from proceeding with creating the user. You also would send the error message to a label you defined on your aspx form stating the RECAPTCHA did not match.

If  the recaptcha.Validate isValid = True, you can make the recaptcha control invisible on your form along with a message stating the user was created successfully by adding the following code to your CreateUserWizard_CreatedUser event as follows:

recaptcha.Visible = False

That’s all there is to it.

Microsoft Visual Studio 2010 – How to Set Up Forms Authentication for Your ASP.NET Web Site

After developing a web site that uses Forms Authentication, you need to create a SQL database that stores the client’s log-in information along with any profiles. The tool that creates the tables in your database that is needed for your application exists on your computer within the .NET Framework.

1) Log in to your cPanel and create a SQL Database and call it what you want. For example: MyDatabaseASPNETDB

2) Assign and user and password to the Database.

3) Run the ASP.Net SQL Server Setup Wizard located in your .NET Framework directory. The wizard is called aspnet_regsql.exe.

For example, the path might be C:WindowsMicrosoft.NETFrameworkv2.0.50727aspnet_regsql.exe

4) Click Next and choose Configure SQL Server for application services

5) Click Next and enter your server name, log in information assigned to the database you created, and the name of the database you created (MyDatabaseASPNETDB)

6) Click Next twice. Wait for the wizard to finish. When complete, click Finish.

7) In your web.config file, add the following connection string:

<add name="LocalSqlServer" connectionString="Data Source=ftp.xxxxxxxxxx.net;Initial Catalog=MyDatabaseASPNETDB;User ID=xxxxxx;Password=xxxxxx" providerName="System.Data.SqlClient" />

That’s it.

Microsoft Visual Studio 2010 – How to pre-compile your “Web Site” and FTP only portions of your site to your Host.

You decided to build a “Web Site” and not a “Web Solution”. You proceed to use the PUBLISH utility in Visual Studio and publish your entire site to your host. You later make a change to your Web Site and discover that using the PUBLISH utility will only publish the entire site all over again. I don’t have to tell YOU why sometimes that causes headaches. What publish does is actually wipe out CLEAN your entire virtual folder.

How to get around this?

Pre-compile your Web Site and FTP only the updates.

How is this done?

Initially publish your Web Site from Visual Studio with the option checked – “Allow this precompiled site to be updatable. This will publish then entire site but also allow you to later “update” the site using the pre-compile feature.

1) Create a new folder on your hard drive that will contain the destination of your pre-compiles.

2) Make a change to your website.

3) Run the pre-compiler:

C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler -p c:[your web site folder] -v / c:[your web site precompile folder] -u

Note: Depending on your version of visual studio affects the framework sub folder name. Replace [your web site folder] with the path on your computer where your web site files exist. Replace [your web site precompile folder] with the path on your computer where your pre-compile will be generated after running the pre-compile.

3) Sign on to your favorite FTP and overlay just the dll’s in the bin folder and all your aspx pages.

Note: Why aspx pages? Because the pre-compile replaces in the Page declaration of each aspx page, CodeFile=”xxxx.aspx.vb” with inherits=”xxxx_POST, App_Web_????????” In other words, it replaces the name of the vb code behind file with the actual dll it executes.

That’s it.