<%
@ Page Language="VB" MasterPageFile="~/Masters/PU89MasterPage.master" AutoEventWireup="false" CodeFile="DuesVerification.aspx.vb" Inherits="DuesVerification" title="Princeton University Class of 1989" %>
<%
@ Register Assembly="Telerik.Web.UI, Version=2008.2.1001.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<Table id="tblDefault" runat="server" class="PageFont" width="100%">
<tr>
<td style="width: 20px">   </td>
<td colspan="2">
<table width="100%">
<tr>
<td class="HeaderText" style="border-bottom: solid 3px #CCCCCC;padding: 0px;height: 10px;width: 100%;color:#000099;font-family:Verdana">Dues Form Verification</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td><div id="BlackLink"><font size="+2"><b>P</b></font>lease verify that <u>all</u> the informaton in the form below is correct. </div>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td><strong><u>Billing Information:</u></strong></td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td>
<center>
<table id="tblDuesInfo" runat="server" cellpadding="5" cellspacing="1" style="background-color: #666666;">
<tr style="background-color:#CCCCCC">
<td align="left" ><font color="red" size="+2">* </font>Last Name:</td>
<td align="left" ><asp:Label ID="lblLastName" runat="server" ForeColor="#000099"></asp:Label></td>
<td align="left" ><font color="red" size="+2">* </font>First Name:</td>
<td align="left" ><asp:Label ID="lblFirstName" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#FFFFFF;">
<td align="left" ><font color="red" size="+2">* </font>Address:</td>
<td align="left" ><asp:Label ID="lblAddress" runat="server" ForeColor="#000099"></asp:Label></td>
<td align="left" >Apt:</td>
<td align="left" ><asp:Label ID="lblApt" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#CCCCCC">
<td align="left" ><font color="red" size="+2">* </font>City:</td>
<td align="left" ><asp:Label ID="lblCity" runat="server" ForeColor="#000099"></asp:Label></td>
<td align="left" >State:</td>
<td align="left" ><asp:Label ID="lblState" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#FFFFFF;">
<td align="left" ><font color="red" size="+2">* </font>Zip / Postal Code:</td>
<td align="left" ><asp:Label ID="lblZip" runat="server" ForeColor="#000099"></asp:Label></td>
<td align="left" ><font color="red" size="+2">* </font>Country:</td>
<td align="left" ><asp:Label ID="lblCountry" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#CCCCCC;">
<td align="left" ><font color="red" size="+2">* </font>e-mail:</td>
<td align="left" colspan="3" ><asp:Label ID="lblEmail" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
</table>
<br />
<br />
</center>
</td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td><strong><u>Dues And Other Contributions:</u></strong></td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td>
<center>
<table id="Table1" runat="server" cellpadding="5" cellspacing="1" style="background-color: #666666;">
<tr style="background-color:#CCCCCC">
<td align="left" style="width: 464px" ><font color="red" size="+2">* </font>Fiscal Year:</td>
<td align="left" ><asp:Label ID="lblFiscalYear" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#FFFFFF">
<td align="left" style="width: 464px" >Dues for Class Activities, Alumni Council and PAW:</td>
<td align="left" >
<asp:Label ID="lblRegularDues" runat="server" ForeColor="#000099"></asp:Label>
</td>
</tr>
<tr style="background-color:#CCCCCC;">
<td align="left" style="width: 464px" >Contribution to Class of 1989 "In the Nation's Service" Fund:</td>
<td align="left" ><asp:Label ID="lblNationsServiceFund" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#FFFFFF;">
<td align="left" style="width: 464px" >Contribution to Campaign for Habitat for Humanity:</td>
<td align="left" ><asp:Label ID="lblHabitatForHumanityFund" runat="server" ForeColor="#000099"></asp:Label></td>
</tr>
<tr style="background-color:#CCCCCC">
<td align="left" style="width: 464px" >Total:</td>
<td align="left" >
<asp:label id="lbltotal" runat="server"></asp:label>
</td>
</tr>
</table>
<br />
<br />
</center>
</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td style="width: 20px">   </td>
<td align="left">
<br />
<br />
<strong>Submit Dues and Go To PayPal Payment Screen</strong>
<br />
<br />
<asp:Button ID="btnDuesEdit" runat="server" Text="CLICK HERE to edit your dues"/>
<br />
<br />
<telerik:RadSplitter ID="rsplPayPalButton" runat="server" Height="149px"
Width="287px" BorderColor="White" BorderSize="0">
<telerik:radpane ID="rpnPayPalButton" runat="server"
Height="125px" Width="281px" BorderColor="White" BorderStyle="None"
Scrolling="None">
</telerik:radpane>
</telerik:RadSplitter>
</td>
</tr>
</Table>
<asp:SqlDataSource ID="dsDuesVerification" runat="Server" ConnectionString="<%$ ConnectionStrings:PU89 %>"
SelectCommand="SELECT * FROM tblDues">
<SelectParameters>
<asp:QueryStringParameter Name="request_no" QueryStringField="ID" Type="Int32" />
</SelectParameters>
</
asp:SqlDataSource>
</
asp:Content>
HTML Paypal form button:
<!
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>
<title>Princeton University Class of 1989</title>
<SCRIPT LANGUAGE="VBScript" runat="server">
<!--
Function SetAmount()
Set TheForm = Document.PaypalButton
myUrl = window.document.location.href
dim pos, amount
pos=InStr(MyURL,"=")
amount = mid(MyURL, pos + 1)
TheForm.amount.Value = amount
End Function
-->
</
SCRIPT>
</
head>
<
body>
<
FORM name="PaypalButton" id="PaypalButton" ACTION="https://www.paypal.com/cgi-bin/webscr" METHOD="POST" runat="server" target="_top">
<
INPUT TYPE="hidden" NAME="cmd" VALUE="_xclick">
<
INPUT TYPE="hidden" NAME="business" VALUE="treasurer@princeton1989.org">
<
INPUT TYPE="hidden" NAME="amount" id="amount">
<
INPUT TYPE="hidden" NAME="item_name" VALUE="Princeton Class of '89 Dues Fee">
<
INPUT TYPE="hidden" NAME="currency_code" VALUE="USD">
<
INPUT TYPE="hidden" NAME="cancel_return" VALUE="http://www.Princeton1989.org/DuesPaymentCancel.aspx">
<
INPUT TYPE="hidden" NAME="return" VALUE="http://www.Princeton1989.org/DuesPaymentSuccess.aspx">
<
INPUT TYPE="hidden" NAME="rm" VALUE="2">
<
INPUT TYPE="hidden" NAME="cbt" VALUE="Return to Princeton1989.org to complete your dues">
<
INPUT TYPE="image" NAME="submit" BORDER="0" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" ALT="PayPal
- The safer, easier way to pay online"
onclick="SetAmount()">
<
img alt="" border="" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</
form>
</
body>
</
html>
VB.NET aspx Page Load Code
Protected
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'Take care of the casheing problem
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetExpires(DateTime.Now)
Dim _ID As Integer = CInt(Request.QueryString("ID"))
Session(
"_ID") = _ID
'Populate the datatable
Dim sConnString As String = ConfigurationManager.ConnectionStrings("PU89").ConnectionString
Dim objConnection As New SqlClient.SqlConnection(sConnString)
Dim strSQL As String = "SELECT * FROM tblDues WHERE ID='" & _ID & "';"
Dim dbComm As New SqlClient.SqlCommand(strSQL, objConnection)
Dim objDR As SqlClient.SqlDataReader
Try
objConnection.Open()
objDR = dbComm.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
While objDR.Read()
With objDR
Me.lblLastName.Text = .Item("LastName") 'required field
Me.lblFirstName.Text = .Item("FirstName") 'required field
Me.lblAddress.Text = .Item("Address") 'required field
If Not .Item("Apt") Is Nothing Then
Me.lblApt.Text = .Item("Apt")
End If
Me.lblCity.Text = .Item("City") 'required field
Me.lblState.Text = .Item("State") 'required field
Me.lblZip.Text = .Item("ZipCode") 'required field
Me.lblCountry.Text = .Item("Country") 'required field
Me.lblEmail.Text = .Item("Email") 'required field
Me.lblFiscalYear.Text = .Item("FiscalYear") 'required field
Me.lblRegularDues.Text = .Item("Dues") 'required field
If Not .Item("NationsServiceFund") Is Nothing Then
Me.lblNationsServiceFund.Text = .Item("NationsServiceFund")
End If
If Not .Item("HabitatForHumanityFund") Is Nothing Then
Me.lblHabitatForHumanityFund.Text = .Item("HabitatForHumanityFund")
End If
Me.lbltotal.Text = .Item("DuesTotal")
'Set Up Session Variables for Email
Session(
"DuesName") = .Item("FirstName") & " " & .Item("LastName")
Session(
"DuesAddress") = .Item("Address")
Session(
"DuesCityStateZip") = .Item("City") & ", " & .Item("State") & " " & .Item("ZipCode")
Session(
"DuesCountry") = .Item("Country")
Session(
"DuesEmail") = .Item("Email")
Session(
"DuesFiscalYear") = .Item("FiscalYear")
Session(
"Dues") = .Item("Dues")
Session(
"DuesNationsServiceFund") = .Item("NationsServiceFund")
Session(
"DuesHabitatForHumanityFund") = .Item("HabitatForHumanityFund")
Session(
"DuesTotal") = .Item("DuesTotal")
Me.rpnPayPalButton.ContentUrl = "~/PayPalDuesFee.htm?ID=" & .Item("DuesTotal")
End With
End While
Catch ex As Exception
Response.Write(ex.Message)
Response.End()
Finally
If objConnection.State = ConnectionState.Open Then
objConnection.Close()
End If
End Try
End If
End Sub 'Page_Load
|
Ok, I know the subject doesn't make sense, but I am at the point of ripping my hair out over this. I have a struct which contains other structs (also tag serializable) shown below. I am heavily using Telerik controls in this app and as the user follows this tab driven wizard, information from each tab is added to the TestConfig object in ViewState. This works flawlessly, until... you let the browser sit for 4 or so minutes. If at any point in time you sit on a particular tab and wait the requsite 240+ seconds, when the user clicks next, the debugger throws an InvalidCastException. Here is the interesting part. The cast is a simple return of the object from ViewState (below). The object in ViewState no longer thinks it is a TestConfig object. It will allow me to cast it as an object as it rightfully should and I can even drill down into the object within VS2008 and see all of the data is still there. Somehow it is losing its type and I cannot for the life of me figure it out. I am at the point of either moving to a database solution or if it doesn't make sense to do that, hidden controls, but I would really like to just resolve this the right way. Anyone have any thoughts?
Structs:
[Serializable]
public struct TestConfig
{
public GridData oTestType;
public GridData oArchitecture;
public GridData oBuild;
public GridData oBuildType;
public List<GridData> gloLanguages;
public List<GridData> gloOperatingSystems;
public List<GridData> gloFamilies;
public List<TestDriverData> gloTestDriverData;
}
[Serializable]
public struct TestDriverData
{
public string sPath;
public string sModel;
public string sModelDisplayString;
public string sPort;
public string sPdl;
public string sPdlDisplayString;
public string sFamily;
}
[Serializable]
public struct GridData
{
public string sDisplay;
public string sData;
public string sMisc;
}
Return Code:
return (TestConfig)ViewState["m_TestConfig"];
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|