There is a search box on the Master page that takes a value and calls code that provide a details page on that item. The Master page form takes a 'butterfly name' and the button calls the details page on that butterfly.
When I try to run this code from a form based on the Mater page, I receive:
'System.NullReferenceException: 'Object reference no set to an instance of an object.' Systems.Collections.Specialized.NameValueCollection.this[string].get returned null
Master Page ASPX
<input id="searchButterflies" runat="server" type="text" class="form-control mr-2" placeholder="Butterfly Name" style="width: 170px; font-size: .8em;" />
<asp:Button runat="server" ID="btnButterflySearch" CssClass="btn btn-outline-light" OnClick="btnButterflySearch_Click" Text="Search" />
Master Page Code-behind
protected void btnButterflySearch_Click(object sender, EventArgs e)
{
string btrfly = Request.Form["searchButterflies"].ToString();
Session["SearchString"] = btrfly;
Session["SearchString"] = searchButterflies.ToString();
Response.RedirectPermanent("../BU/BU_SearchName.aspx?Type=SB" + "&Group=" + btrfly);
}
Thank you for any help you can provide.