I've a search box which is on a master page. i used request.form to get the value to be searched. it is working fine when the previous page is not a secure page but such as login page and other web page that is secure i get nothing value. any idea on how i can work-around this?
I forgot to mention that I'm using postbackurl to go to the target page.
<div class="search-div">
<asp:TextBox ID="searchBox" runat="server" Text="Type Part Number Here" style="font-weight: lighter; font-style: normal; color: #C0C0C0" onfocus="OnSearchBoxFocus('searchBox');" onblur="OnSearchBoxLostFocus('searchBox');"></asp:TextBox>
<asp:ImageButton ID="searchButton" runat="server" EnableViewState="false" CssClass="search-button" ImageUrl="~/images/search.png" BorderWidth="0px" Width="32" Height="28" type="submit" PostBackUrl="~/SearchResults.aspx" />
</div>
If Not IsPostBack Then
Dim strBoxName As String = PublicVariables.webSearchBoxControlName
Dim strSearchValue As String = Request.Form(strBoxName)
End If
The reason is that you use some kind of https
to http
automatic redirect that is not, and can not handle the post data.
The solution is to direct make the post from https to http page, eg change this:
PostBackUrl="~/SearchResults.aspx"
to
PostBackUrl="http://example.com/dir/SearchResults.aspx"
I test that and is working, from one https page post to a new diferent http page.