I have a TextBox (txtTopSearchBox on the MasterPage at the top of my ASP.NET Web Forms pages.
<asp:Panel ID="TopSearchHolder" runat="server" CssClass="TopSearchHolder" DefaultButton="btnTopSearch">
<label for="txtTopSearchBox" class="TopSearchBoxLabel">Quick Search:</label>
<asp:TextBox ID="txtTopSearchBox" runat="server" ValidationGroup="TopSearch" CssClass="TopTextBox" AutoCompleteType="Disabled" />
<asp:ImageButton ID="btnTopSearch" runat="server" ImageUrl="~/MediaFiles/SmallSearchButtonOut.png"
AlternateText="Search" ToolTip="Search" ValidationGroup="TopSearch" CssClass="TopSearchButton" />
<div id="TopSearchOptions">
<asp:RadioButton ID="rbCaseID" runat="server" Text="Case ID" GroupName="TopSearchGroup" Checked="true" />
<asp:RadioButton ID="rbClaimant" runat="server" Text="Claimant" GroupName="TopSearchGroup" />
<asp:RadioButton ID="rbPostcode" runat="server" Text="Postcode" GroupName="TopSearchGroup" />
<asp:RadioButton ID="rbVRM" runat="server" Text="Car Reg" GroupName="TopSearchGroup" />
<asp:RadioButton ID="rbReport" runat="server" Text="Report" GroupName="TopSearchGroup" />
</div>
</asp:Panel>
When clicking GO, the following should be hit which directs you to the right case etc.
Protected Sub btnTopSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTopSearch.Click
If Not String.IsNullOrWhiteSpace(txtTopSearchBox.Text) Then
If rbCaseID.Checked Then
Dim intCaseID As Int32 = 0
If Int32.TryParse(txtTopSearchBox.Text, intCaseID) Then
Redirect($"~/LoggedIn/Cases/View/{If(Products.GetProductShortCode(intCaseID) = "AF", "AuthorisedFunding", "Default")}.aspx?CaseID={intCaseID}", True)
End If
ElseIf rbClaimant.Checked Then
Redirect(String.Format("~/LoggedIn/Cases/Default.aspx?ClaimantName={0}", HttpUtility.UrlEncode(txtTopSearchBox.Text)), True)
ElseIf rbPostcode.Checked Then
Redirect(String.Format("~/LoggedIn/Cases/Default.aspx?Postcode={0}", HttpUtility.UrlEncode(txtTopSearchBox.Text)), True)
ElseIf rbReport.Checked Then
Redirect(String.Format("~/LoggedIn/reports?Search={0}", HttpUtility.UrlEncode(txtTopSearchBox.Text)), True)
ElseIf rbVRM.Checked Then
Redirect(String.Format("~/LoggedIn/Cases/VehicleSearch.aspx?VRM={0}", HttpUtility.UrlEncode(txtTopSearchBox.Text)), True)
End If
End If
End Sub
The trouble is that when moving to Azure AD logins, the button's code works fine from here https://localhost:44300/LoggedIn/Default.aspx but it does not get fired if I try from here (the root of the application). https://localhost:44300/
Any ideas why?
The startup URL in Azure is https://localhost:44300/signin-oidc and logout is https://localhost:44300/signout-oidc
Thank you.
This was solved by adding a line in the MasterPage's Page_Load as follows.