Events not firing after a Response.Redirect from another Web App

G

Guest

I have two web applications that I am working with and I am trying to do a
Response.Redirect from one to the other. They are setup as separate web
applications on the same IIS server. If I go directly to the second
application in a browser, all of my events fire correctly. However, if I
have the first application do a Response.Redirect to the second, for some
reason none of my events on the second application ever get fired. After I
perform some action on the second application and it posts back to itself,
the IsPostBack is always returning false.

Does anyone know what could be causing this to happen?

I would greatly appreciate your help on this.
 
J

Jeppe Dige Jespersen

Could you post complete code, both from the .aspx and the code-behind?

Jeppe Jespersen
 
G

Guest

Here is the ASPX code:

<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="AccessFormGetADID.aspx.vb" Inherits="Access.AccessFormGetADID" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<HEAD>
<title>
<asp:literal runat="server" id="litPageTitle" />
</title>
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Concentra">
<link href="/includes/css/my.css" type="text/css" rel="stylesheet">
<!-- TemplateBeginEditable name="EditableHead" --> <!--
TemplateEndEditable -->
</HEAD>
<body>
<div id="site">
<div id="frame">
<div id="border">
<div id="top">
<div id="topBG"><a href="solutionCenter.aspx">Contact the Solution
Center</a></div>
</div>
<div id="frameContent">
<div id="frameBG" style="BACKGROUND-IMAGE: none">
<div id="utility">
<div id="utilityForm" style="FLOAT:left">
</div>
<div id="utilityLinks" style="FLOAT:right">
</div>
</div>
<div id="mainContent">
<form runat="server">
<div id="actualContent"><div id="pageTitle">Problems Accessing
MyConcentra?</div>
<!-- TemplateBeginEditable name="PageContent" -->
<asp:label id="lblTitle" runat="server" font-bold="True"
cssclass="sectionTitles">Setup My Active Directory ID</asp:label>
<BR>
<BR>
<asp:label id="lblMessage" runat="server" font-bold="True">All
information should be entered as it exists on your pay check.</asp:label>
<BR>
<BR>
<asp:label id="lblSearchError" runat="server" font-bold="true"
forecolor="#ff0000"></asp:label>
<asp:table id="tblADID" runat="server" cellspacing="0"
cellpadding="4">
<asp:tablerow>
<asp:tablecell horizontalalign="Right">Active Directory
ID</asp:tablecell>
<asp:tablecell>
<asp:label id="lblADID" runat="server" forecolor="#ff0000"
font-bold="true" />
</asp:tablecell>
</asp:tablerow>
</asp:table>
<asp:table id="tblFormGetADID" runat="server" cellspacing="0"
cellpadding="4">
<asp:tablerow>
<asp:tablecell horizontalalign="Right">First Name</asp:tablecell>
<asp:tablecell>
<asp:textbox runat="server" id="txtSearchFirstName" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchFirstName" display="Dynamic" errormessage="*"
id="requSFirstName" />
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right">Last Name</asp:tablecell>
<asp:tablecell>
<asp:textbox runat="server" id="txtSearchLastName" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchLastName" display="Dynamic" errormessage="*"
id="requSLastName" />
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right"
verticalalign="Top">EmployeeID</asp:tablecell>
<asp:tablecell verticalalign="Top" >
<asp:textbox runat="server" id="txtSearchEmployeeID"
maxlength="8" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchEmployeeID" display="Dynamic" errormessage="*"
id="requSEmployeeID" />
<br>
7 digits including leading zeros
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right" verticalalign="Top">Birth
Date</asp:tablecell>
<asp:tablecell verticalalign="Top">
<asp:textbox runat="server" id="txtSearchBirthDate"
maxlength="10" />
<asp:regularexpressionvalidator runat="server"
controltovalidate="txtSearchBirthDate" display="Dynamic" errormessage="*
(MM/DD/YYYY)"
validationexpression="^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2})$" id="Regularexpressionvalidator1" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchBirthDate" display="Dynamic" errormessage="*
(MM/DD/YYYY)" id="requSBirthDate" />
<br>
Ex: 08/25/2005
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell columnspan="2" horizontalalign="Center">
<asp:button runat="server" id="btnSearch" text="Search" />
</asp:tablecell>
</asp:tablerow>
</asp:table>
<!-- TemplateEndEditable -->
</div>
</form>
</div>
<div class="cleaner"></div>
</div>
</div>
</div>
</div>
<div id="copyright">
<div id="right">
<div id="left">
<div id="bottom">
<asp:label runat="server" id="lblCopyright" text="© 2005 Concentra
Operating Corp. All Rights Reserved." />
</div>
</div>
</div>
</div>
</div>
</body>
</HTML>



codebehind page:


Imports System.Data.SqlClient

Public Class AccessFormGetADID
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
Protected WithEvents txtSearchFirstName As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchLastName As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchEmployeeID As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchBirthDate As
System.Web.UI.WebControls.TextBox
Protected WithEvents lblADID As System.Web.UI.WebControls.Label
Protected WithEvents btnSearch As System.Web.UI.WebControls.Button
Protected WithEvents lblSearchError As System.Web.UI.WebControls.Label
Protected WithEvents tblADID As System.Web.UI.WebControls.Table
Protected WithEvents tblFormGetADID As System.Web.UI.WebControls.Table
Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
Protected WithEvents lblTitle As System.Web.UI.WebControls.Label
Protected WithEvents lblCopyright As System.Web.UI.WebControls.Label

'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

Private strADID As String

Private strConnectionString As String = "Data Source=ADD1WAAH; Initial
Catalog=Security; User ID=XXXX;Password=XXXX"

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Page.Trace.Warn("IsPostBack = " + IsPostBack.ToString())

strADID = Request.QueryString("ADID")
lblADID.Text = strADID
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles btnSearch.Click
' if the ADID was detected, then just tie it to the people record
Trace.Warn("Search Event.")

If Not (strADID Is Nothing) Then
Trace.Warn("Tie AD ID to person record.")
If (TieADIDtoPersonRecord(strADID) = False) Then
Me.lblSearchError.Visible = True
Me.lblSearchError.Text = "The information entered could not
be resolved in the database.<br>Please check the information entered and try
again."
Me.tblADID.Visible = True
Me.tblFormGetADID.Visible = True
Else
Me.lblSearchError.Visible = False
Me.lblSearchError.Text = ""
Me.tblADID.Visible = False
Me.tblFormGetADID.Visible = False
End If
Me.lblADID.Text = strADID
Else
If (SearchPersonRecord() = False) Then
Me.lblSearchError.Visible = True
Me.lblSearchError.Text = "Person could not be found in the
database."
Me.tblFormGetADID.Visible = True
Else
Me.lblSearchError.Visible = False
Me.lblSearchError.Text = ""
Me.tblFormGetADID.Visible = False
Me.tblADID.Visible = True
End If
End If
End Sub
Private Function TieADIDtoPersonRecord(ByVal str As String) As Boolean
Dim conn As New SqlConnection(strConnectionString)
Dim cmd As SqlCommand
Dim strCommand = "usp_TieADIDToPerson"
Dim blnReturn As Boolean = True
Try
Trace.Warn("str = " + str)
conn.Open()
cmd = New SqlCommand(strCommand, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@v_employeeID",
Me.txtSearchEmployeeID.Text))
cmd.Parameters.Add(New SqlParameter("@v_firstName",
Me.txtSearchFirstName.Text))
cmd.Parameters.Add(New SqlParameter("@v_lastName",
Me.txtSearchLastName.Text))
cmd.Parameters.Add(New SqlParameter("@v_birthDate",
Me.txtSearchBirthDate.Text))
cmd.Parameters.Add(New SqlParameter("@v_ADID", str))
cmd.ExecuteNonQuery()
lblADID.Text = cmd.Parameters("@v_ADID").Value

Me.lblMessage.Visible = True
Me.lblMessage.Text = "Your account has been setup. You may now
access <a href=""http://myconcentra/"">MyConcentra</a>."
Catch exc As Exception
blnReturn = False
Finally
conn.Close()
End Try

Return blnReturn
End Function
Private Function SearchPersonRecord() As Boolean
Dim conn As New SqlConnection(strConnectionString)
Dim cmd As SqlCommand
Dim strCommand = "usp_SearchPersonReturnADID"
Dim blnReturn As Boolean = True
Try
conn.Open()
cmd = New SqlCommand(strCommand, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@v_employeeID",
Me.txtSearchEmployeeID.Text))
cmd.Parameters.Add(New SqlParameter("@v_firstName",
Me.txtSearchFirstName.Text))
cmd.Parameters.Add(New SqlParameter("@v_lastName",
Me.txtSearchLastName.Text))
cmd.Parameters.Add(New SqlParameter("@v_birthDate",
Me.txtSearchBirthDate.Text))
cmd.Parameters.Add(New SqlParameter("@v_ADID",
SqlDbType.VarChar, 200))
cmd.Parameters("@v_ADID").Direction = ParameterDirection.Output
cmd.ExecuteNonQuery()
lblADID.Text = cmd.Parameters("@v_ADID").Value

Me.lblMessage.Visible = True
Me.lblMessage.Text = "Your Active Directory ID has been found.
You may now login to MyConcentra."
Catch exc As Exception
blnReturn = False
Finally
conn.Close()
End Try

Return blnReturn
End Function
End Class
 
J

Jeppe Dige Jespersen

Hello Michael,

Thansk for posting the code. I tried a setup similar to what i believe
you're trying, and unfortunately, I'm not getting the same results as you.

I put the posted code in app2, and created an app1 that simply
response.redirects to app2. Page_Load fires when i redirect to app2, and
when I postback on app2, the isPostback returns what it should. True.

So for this one, I'll have to throw in my towel. :-(

Jeppe



michael_vanommeren said:
Here is the ASPX code:

<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="AccessFormGetADID.aspx.vb" Inherits="Access.AccessFormGetADID"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<HEAD>
<title>
<asp:literal runat="server" id="litPageTitle" />
</title>
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Concentra">
<link href="/includes/css/my.css" type="text/css" rel="stylesheet">
<!-- TemplateBeginEditable name="EditableHead" --> <!--
TemplateEndEditable -->
</HEAD>
<body>
<div id="site">
<div id="frame">
<div id="border">
<div id="top">
<div id="topBG"><a href="solutionCenter.aspx">Contact the Solution
Center</a></div>
</div>
<div id="frameContent">
<div id="frameBG" style="BACKGROUND-IMAGE: none">
<div id="utility">
<div id="utilityForm" style="FLOAT:left">
</div>
<div id="utilityLinks" style="FLOAT:right">
</div>
</div>
<div id="mainContent">
<form runat="server">
<div id="actualContent"><div id="pageTitle">Problems Accessing
MyConcentra?</div>
<!-- TemplateBeginEditable name="PageContent" -->
<asp:label id="lblTitle" runat="server" font-bold="True"
cssclass="sectionTitles">Setup My Active Directory ID</asp:label>
<BR>
<BR>
<asp:label id="lblMessage" runat="server" font-bold="True">All
information should be entered as it exists on your pay check.</asp:label>
<BR>
<BR>
<asp:label id="lblSearchError" runat="server" font-bold="true"
forecolor="#ff0000"></asp:label>
<asp:table id="tblADID" runat="server" cellspacing="0"
cellpadding="4">
<asp:tablerow>
<asp:tablecell horizontalalign="Right">Active Directory
ID</asp:tablecell>
<asp:tablecell>
<asp:label id="lblADID" runat="server" forecolor="#ff0000"
font-bold="true" />
</asp:tablecell>
</asp:tablerow>
</asp:table>
<asp:table id="tblFormGetADID" runat="server" cellspacing="0"
cellpadding="4">
<asp:tablerow>
<asp:tablecell horizontalalign="Right">First Name</asp:tablecell>
<asp:tablecell>
<asp:textbox runat="server" id="txtSearchFirstName" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchFirstName" display="Dynamic" errormessage="*"
id="requSFirstName" />
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right">Last Name</asp:tablecell>
<asp:tablecell>
<asp:textbox runat="server" id="txtSearchLastName" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchLastName" display="Dynamic" errormessage="*"
id="requSLastName" />
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right"
verticalalign="Top">EmployeeID</asp:tablecell>
<asp:tablecell verticalalign="Top" >
<asp:textbox runat="server" id="txtSearchEmployeeID"
maxlength="8" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchEmployeeID" display="Dynamic" errormessage="*"
id="requSEmployeeID" />
<br>
7 digits including leading zeros
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell horizontalalign="Right" verticalalign="Top">Birth
Date</asp:tablecell>
<asp:tablecell verticalalign="Top">
<asp:textbox runat="server" id="txtSearchBirthDate"
maxlength="10" />
<asp:regularexpressionvalidator runat="server"
controltovalidate="txtSearchBirthDate" display="Dynamic" errormessage="*
(MM/DD/YYYY)"
validationexpression="^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2})$"
id="Regularexpressionvalidator1" />
<asp:requiredfieldvalidator runat="server"
controltovalidate="txtSearchBirthDate" display="Dynamic" errormessage="*
(MM/DD/YYYY)" id="requSBirthDate" />
<br>
Ex: 08/25/2005
</asp:tablecell>
</asp:tablerow>
<asp:tablerow>
<asp:tablecell columnspan="2" horizontalalign="Center">
<asp:button runat="server" id="btnSearch" text="Search" />
</asp:tablecell>
</asp:tablerow>
</asp:table>
<!-- TemplateEndEditable -->
</div>
</form>
</div>
<div class="cleaner"></div>
</div>
</div>
</div>
</div>
<div id="copyright">
<div id="right">
<div id="left">
<div id="bottom">
<asp:label runat="server" id="lblCopyright" text="© 2005 Concentra
Operating Corp. All Rights Reserved." />
</div>
</div>
</div>
</div>
</div>
</body>
</HTML>



codebehind page:


Imports System.Data.SqlClient

Public Class AccessFormGetADID
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
Protected WithEvents txtSearchFirstName As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchLastName As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchEmployeeID As
System.Web.UI.WebControls.TextBox
Protected WithEvents txtSearchBirthDate As
System.Web.UI.WebControls.TextBox
Protected WithEvents lblADID As System.Web.UI.WebControls.Label
Protected WithEvents btnSearch As System.Web.UI.WebControls.Button
Protected WithEvents lblSearchError As System.Web.UI.WebControls.Label
Protected WithEvents tblADID As System.Web.UI.WebControls.Table
Protected WithEvents tblFormGetADID As System.Web.UI.WebControls.Table
Protected WithEvents lblMessage As System.Web.UI.WebControls.Label
Protected WithEvents lblTitle As System.Web.UI.WebControls.Label
Protected WithEvents lblCopyright As System.Web.UI.WebControls.Label

'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

Private strADID As String

Private strConnectionString As String = "Data Source=ADD1WAAH; Initial
Catalog=Security; User ID=XXXX;Password=XXXX"

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Page.Trace.Warn("IsPostBack = " + IsPostBack.ToString())

strADID = Request.QueryString("ADID")
lblADID.Text = strADID
End Sub
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles btnSearch.Click
' if the ADID was detected, then just tie it to the people record
Trace.Warn("Search Event.")

If Not (strADID Is Nothing) Then
Trace.Warn("Tie AD ID to person record.")
If (TieADIDtoPersonRecord(strADID) = False) Then
Me.lblSearchError.Visible = True
Me.lblSearchError.Text = "The information entered could not
be resolved in the database.<br>Please check the information entered and
try
again."
Me.tblADID.Visible = True
Me.tblFormGetADID.Visible = True
Else
Me.lblSearchError.Visible = False
Me.lblSearchError.Text = ""
Me.tblADID.Visible = False
Me.tblFormGetADID.Visible = False
End If
Me.lblADID.Text = strADID
Else
If (SearchPersonRecord() = False) Then
Me.lblSearchError.Visible = True
Me.lblSearchError.Text = "Person could not be found in the
database."
Me.tblFormGetADID.Visible = True
Else
Me.lblSearchError.Visible = False
Me.lblSearchError.Text = ""
Me.tblFormGetADID.Visible = False
Me.tblADID.Visible = True
End If
End If
End Sub
Private Function TieADIDtoPersonRecord(ByVal str As String) As Boolean
Dim conn As New SqlConnection(strConnectionString)
Dim cmd As SqlCommand
Dim strCommand = "usp_TieADIDToPerson"
Dim blnReturn As Boolean = True
Try
Trace.Warn("str = " + str)
conn.Open()
cmd = New SqlCommand(strCommand, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@v_employeeID",
Me.txtSearchEmployeeID.Text))
cmd.Parameters.Add(New SqlParameter("@v_firstName",
Me.txtSearchFirstName.Text))
cmd.Parameters.Add(New SqlParameter("@v_lastName",
Me.txtSearchLastName.Text))
cmd.Parameters.Add(New SqlParameter("@v_birthDate",
Me.txtSearchBirthDate.Text))
cmd.Parameters.Add(New SqlParameter("@v_ADID", str))
cmd.ExecuteNonQuery()
lblADID.Text = cmd.Parameters("@v_ADID").Value

Me.lblMessage.Visible = True
Me.lblMessage.Text = "Your account has been setup. You may now
access <a href=""http://myconcentra/"">MyConcentra</a>."
Catch exc As Exception
blnReturn = False
Finally
conn.Close()
End Try

Return blnReturn
End Function
Private Function SearchPersonRecord() As Boolean
Dim conn As New SqlConnection(strConnectionString)
Dim cmd As SqlCommand
Dim strCommand = "usp_SearchPersonReturnADID"
Dim blnReturn As Boolean = True
Try
conn.Open()
cmd = New SqlCommand(strCommand, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New SqlParameter("@v_employeeID",
Me.txtSearchEmployeeID.Text))
cmd.Parameters.Add(New SqlParameter("@v_firstName",
Me.txtSearchFirstName.Text))
cmd.Parameters.Add(New SqlParameter("@v_lastName",
Me.txtSearchLastName.Text))
cmd.Parameters.Add(New SqlParameter("@v_birthDate",
Me.txtSearchBirthDate.Text))
cmd.Parameters.Add(New SqlParameter("@v_ADID",
SqlDbType.VarChar, 200))
cmd.Parameters("@v_ADID").Direction = ParameterDirection.Output
cmd.ExecuteNonQuery()
lblADID.Text = cmd.Parameters("@v_ADID").Value

Me.lblMessage.Visible = True
Me.lblMessage.Text = "Your Active Directory ID has been found.
You may now login to MyConcentra."
Catch exc As Exception
blnReturn = False
Finally
conn.Close()
End Try

Return blnReturn
End Function
End Class





Jeppe Dige Jespersen said:
Could you post complete code, both from the .aspx and the code-behind?

Jeppe Jespersen


"michael_vanommeren" <[email protected]> skrev
i
en meddelelse news:D[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top