Code being called twice in my ASPX Code behind??

  • Thread starter Thread starter C
  • Start date Start date
C

C

Hi,

I have an ASP.Net application.

I have an aspx page with a button that submits the page.

In my codebehind I check if it is a postback and
instantaite a class and use a method of the class.

On coming back from the class I instantiate it hits the
End If of where I check it is a PostBack and runs through
the code again.

Am new to ASPX.

Anyone know what could be wrong?

Thanks,
C.
 
Here is the codebehind my ASPX..


Public Class RetrievePassword
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

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

End Sub

'NOTE: The following placeholder declaration is
required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As
System.Object

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

Public strResponse As String
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here


If IsPostBack() Then
'Call RetrievePassword Function in User Class
If Request.Form("txSubmit") = "Go" Then
Dim strUserName As String = Request.Form
("txUserName")
Dim objUser As User = New User
'Retrieve password and email to user
objUser.RetrievePassword(strUserName)
strResponse = "Your Password will be sent
to your EMail account"
objUser = Nothing
End If
End If

End Sub

End Class
 
is your AutoEventWireup set to true ?

Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top