Click to See Complete Forum and Search --> : Changing source code for an existing webapp


Nostromo77
04-10-2007, 04:04 PM
Hello,

I'm trying to make some minor changes to the validation code of a checkout page in an ASP.NET webapp. The original builder of the site stripped out the VB codebehind files, leaving just the .aspx files, .dll, and so on in the FTP site.

I have recently recieved from the site-builder all of the original source code, so now I don't have to try to decompile it in Reflector. I have dumped the original checkout_main.aspx.vb source file into the FTP site, and it shows up nested behind its respective .aspx page.

I have made the minor changes (just commenting out some validation code so it doesn't function), but the webpage doesn't seem to recognize the changes. "Building" the codebehind page fails, and several errors show up in VS2005: almost every "name" on the codebehind page is "not declared". Does this mean that the source page is referencing some other VB page that is missing, and therefore cannot compile into a new dll? Should I replace each and every sourcecode file into the FTP site before it can recompile with changes?

Thanks for any help.

Imports System.Data.SqlClient
Imports System.Web.Mail
Namespace petstorewebsite
Partial Class checkout_main
Inherits System.Web.UI.Page
Protected WithEvents loginid As System.Web.UI.WebControls.TextBox
Protected WithEvents password As System.Web.UI.WebControls.TextBox
Protected WithEvents password1 As System.Web.UI.WebControls.TextBox
Protected WithEvents CompareFieldValidator1 As System.Web.UI.WebControls.CompareValidator
Protected WithEvents hint_q As System.Web.UI.WebControls.DropDownList
Protected WithEvents Hint_answeer As System.Web.UI.WebControls.TextBox
Protected WithEvents Salutation As System.Web.UI.WebControls.DropDownList
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
Dim chk_lib As New main()
Dim retval As String
Dim insertstr As String
Dim b_addr As String
Dim b_city1 As String
Dim b_state1 As String
Dim b_pn As String
Dim ots As String
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myconnection = New SqlConnection(ConfigurationSettings.AppSettings("DSN_PET"))
myconnection.Open()
Session("login_session") = Session.SessionID
If Session("user_name") = "" Then
user_name.Text = "Guest"
myprofile.Text = "| <a href=index.aspx class=styleclass>Login</a>"
Else
user_name.Text = Session("user_name")
If Session("login") = "Retailer" Then
myprofile.Text = "| <a href=edit_retailer_info.aspx class=styleclass>My Profile</a> | <a href=logout.aspx class=styleclass>Logout</a>"
ElseIf Session("login") = "International" Then
myprofile.Text = "| <a href=edit_interantional_info.aspx class=styleclass>My Profile</a> | <a href=logout.aspx class=styleclass>Logout</a>"

End If
End If
' price1.Text = Session("price_pay")
End Sub
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
myconnection.Close()
End Sub

Private Sub submit_ag_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles submit_ag.Click
If Trim(fname.Text) = "" Then
message.Text = "Please specify your name"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If
Session("fname_12") = fname.Text
If Trim(address.Text) = "" Then
message.Text = "Please specify your street address"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If
Session("address") = address.Text
If Trim(city.Text) = "" Then
message.Text = "Please specify your city"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If
Session("city") = city.Text
If Trim(pin.Text) = "" Then
message.Text = "Please specify your zip code"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If
Session("pin") = pin.Text
If Trim(phone.Text) = "" Then
message.Text = "Please specify your phone number"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If

If Trim(pin.Text) <> "" Then
If chk_lib.chknum(Trim(pin.Text)) = False Then
message.Text = "Your zip code must be entered as a number (i.e. '01913')"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If
End If



If term.Checked = False Then

message.Text = "It is required that you read and accept our Terms & Conditions"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If


Dim country1 As String = "country"
Dim state1 As String = Replace(Trim(state.SelectedItem.Text), "'", "''")
Dim city1 As String = Replace(Trim(city.Text), "'", "''")
Dim b_country1 As String = "country1"
If b_state12.SelectedItem.Text <> "" Then
b_state1 = Replace(Trim(b_state12.SelectedItem.Text), "'", "''")
Else
b_state1 = ""
End If
If b_city.Text <> "" Then
b_city1 = Replace(Trim(b_city.Text), "'", "''")
Else
b_city1 = ""
End If
Dim fnm As String = Replace(Trim(fname.Text), "'", "''")

Dim addr As String = Replace(Replace(Trim(address.Text), "'", "''"), vbCrLf, "<br>")
If b_address.Text <> "" Then
b_addr = Replace(Replace(Trim(b_address.Text), "'", "''"), vbCrLf, "<br>")
Else
b_addr = ""
End If
Dim pn As String = Replace(Trim(pin.Text), "'", "''")
If b_pin.Text <> "" Then
b_pn = Replace(Trim(b_pin.Text), "'", "''")
Else
b_pn = ""
End If
Dim tl As String = "t1"
Dim mob As String = "mob"
Dim eml As String
Dim gu As String = "w"
Dim promotional1 As String
If promotional.Checked = True Then
promotional1 = "Y"
Else
promotional1 = "N"
End If
If Trim(email.Text) = "" Then
message.Text = "Please Specify Email Address"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
End If


If chk_lib.chk_email(Trim(email.Text)) = False Then
message.Text = "Please correct the format of your email address (i.e. 'jane@mailserver.com')"
message.Style("color") = "Red"
message.Font.Bold = True
Exit Sub
Else
eml = Replace(Trim(email.Text), "'", "''")
End If
Session("email_id_user") = eml
If state.SelectedItem.Text <> "Select State in the U.S" Then
ots = ""

Else
If state.SelectedItem.Text = "Select State in the U.S" Then
state1 = "Other"
ots = Replace(Trim(other_st.Text), "'", "''")
Session("other_st") = ots
End If
End If

Session("state_belongs") = state.SelectedItem.Text[code removed to fit constraints of post]
mycommand = New SqlCommand(insertstr, myconnection)
mycommand.ExecuteNonQuery()

insertstr = "delete from shoppingcarts where date_of< '" & Now().Date.ToShortDateString & " '"
mycommand = New SqlCommand(insertstr, myconnection)
mycommand.ExecuteNonQuery()
''''''''''''''''''''''''''''''option_of_product_buying
' Response.Redirect("creditcard_detail.aspx")
Response.Redirect("option_of_product_buying.aspx")
End Sub

End Class

End Namespace

PeOfEo
04-11-2007, 09:34 AM
You need to build it all together so that the compiler can link everything properly. I am a bit confused, have you not removed the former dll?