Did you try the official method as described in the FAQ?
Q. How do I create a search form on my ASPX pages?
Since you don't appear to have multiple submit forms on your ASPX page, the method described by Kiboumz in the earlier posts are not necessary.
If you continue to have trouble, you can contact us by email and we could put you on the alpha testing for V6 which features a native ASP.NET solution.
Announcement
Collapse
No announcement yet.
Search Problem with ASP.NET page
Collapse
X
-
http://kerkstoel.interhostsolutions.be
Right in top corner you'll find the searchbox
Leave a comment:
-
Can you post the URL to the page in question so that we can see the problem.
Leave a comment:
-
I have the same problem, and didn't manage to get it to work.. I understand that it could be the problem of the same variablenames? Do you mean the "?zoom_query=". I think this isn't possible to change, or am i wrong?
here is my code:
masterpage:<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_click" Text="Search" />==> this works fineprotected void btnSearch_click(object sender, EventArgs e)
{
Response.Redirect("search.aspx?zoom_query=" + txtSearch.Text);
}
On my search page:==> If I fill in my searchbox en tap the submit button, it still searches for the keyword I entered before (in my searchbox from the masterpage).protected void Page_Load(object sender, EventArgs e)
{
string paramStr = "";
int parampos = Request.RawUrl.IndexOf("?");
if (parampos >= 0)
paramStr = Request.RawUrl.Substring(parampos + 1);
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"f:\inetpub\vhosts\xxx\subdomains\xxx\cgi-bin\search.cgi";
psi.EnvironmentVariables["REQUEST_METHOD"] = "GET";
psi.EnvironmentVariables["QUERY_STRING"] = paramStr;
psi.EnvironmentVariables["REMOTE_ADDR"] = Request.ServerVariables["REMOTE_ADDR"];
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
Process proc = Process.Start(psi);
proc.StandardOutput.ReadLine(); // skip the HTTP header line
string zoom_results = proc.StandardOutput.ReadToEnd(); // read from stdout
proc.WaitForExit();
// Print the output
//Response.Write(zoom_results);
divSearchResult.InnerHtml = zoom_results;
}
Anyone?
thx
Leave a comment:
-
If you had exactly the same problem, then the same solution should work. Maybe it would help if you described your problem, the code your are using and give a URL to the page in question.
Leave a comment:
-
Hi,
I have the same problem and the solution proposed by Kiboumz doesn't work. The same problem with the solution proposed in the FAQ "Q. How do I create a search form on my ASPX pages?"
Any suggestions?
Fra
Leave a comment:
-
Oh I just re-read your post, and see now that you meant you have two search boxes (presumably of the same variable name, ie. "zoom_query") on the same page. It should not be a problem if you have multiple text boxes on the page (with different variable names), but yes, it would be an issue if they have the same name. In that case, your above solution would be better.
Leave a comment:
-
Hi,
Yes I was using the Aspx search form proposed in the FAQ and it's wasn't fonctionned correctly.
Leave a comment:
-
That should work, and I'm glad to hear you've got it in the end.
When you referred to what was proposed in the FAQ, were you using the search form as described on the ASP.NET page below?
Q. How do I create a search form on my ASPX pages?
Note that this is a different form to those given for non-ASPX pages. I'm curious because that should work despite the multiple textboxes on your page.
Leave a comment:
-
Hi,
I think I found a solution.
Instead of using what you propose in the FAQ. I use the Asp.Net control like this :
<asp:TextBox ID="txtSearch" Runat="Server" />
<asp:Button ID="btnSearch" Runat="Server" OnClick="btnSearch_Click" Text="Go" />
protected void btnSearch_Click(object sender, EventArgs e)
{
Response.Redirect("MySearchPagePath.Asxp?zoom_quer y=" + txtSearch.Text);
}
And that seems work better than your solution.
Leave a comment:
-
Hi,
I think I found why this problems occur.
It's because on the same page I got two search textbox. If I remove one, it's work, but I need to have two.
One at the left top corner and one in the Aspx page.
Nervertheless, I don't know how I could result this problem ...
Leave a comment:
-
Hi,
Thx for your reply.
You understand my problem correctly. My link back url is like you said.
Here my code :
Search.aspx
Code:<%@ Page Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Recherche"%> <asp:Content ID="contentMain" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server"> <div ID="divSearchResult" Runat="Server"> </div> </asp:Content>
Code:public partial class Search : BasePage { protected void Page_Load(object sender, EventArgs e) { string paramStr = ""; int parampos = Request.RawUrl.IndexOf("?"); if (parampos >= 0) paramStr = Request.RawUrl.Substring(parampos + 1); ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = Server.MapPath("../Search/search.cgi"); psi.EnvironmentVariables["REQUEST_METHOD"] = "GET"; psi.EnvironmentVariables["QUERY_STRING"] = paramStr; psi.EnvironmentVariables["REMOTE_ADDR"] = Request.ServerVariables["REMOTE_ADDR"]; psi.RedirectStandardInput = false; psi.RedirectStandardOutput = true; psi.UseShellExecute = false; Process proc = Process.Start(psi); proc.StandardOutput.ReadLine(); // skip the HTTP header line string zoom_results = proc.StandardOutput.ReadToEnd(); // read from stdout proc.WaitForExit(); // Print the output //Response.Write(zoom_results); divSearchResult.InnerHtml = zoom_results; } }
Last edited by Kiboumz; Jan-22-2008, 08:15 PM.
Leave a comment:
-
Originally posted by Kiboumz View PostI put a textbox searching in my MasterPage and when I search with it it's work. The probleme is when I try to change the searching value in my search page. It's always take my first search ...
And you have embedded the search page within your own ASPX page as described here?
If so, it would sound to me that the problem is either:
(a) An incorrect Link back URL specified on the "Advanced" tab of the Configuration window. Is "http://localhost:1112/WebSite/Site/Search.aspx" the correct location of your ASPX search page?
(b) Your ASPX search page is missing the code which passes the GET parameters to the CGI as a QUERY_STRING. Check the example given on the .NET support page again. If you have modified this significantly, you may want to send us your ASPX page so we can check.
Leave a comment:
-
Hi,
I can't because for now I work in local...
But here some generated Html code :
<!--Zoom Search Engine Version 5.1 (1011)-->
<form method="get" action="http://localhost:1112/WebSite/Site/Search.aspx" class="zoom_searchform">
Search for: <input type="text" name="zoom_query" size="20" value="undefined" class="zoom_searchbox" />
<input type="submit" value="Submit" class="zoom_button" />
<span class="zoom_results_per_page">Results per page:
<select name='zoom_per_page'><option selected="selected">10</option><option>20</option><option>50</option><option>100</option></select><br /><br /></span>
<span class="zoom_match">Match:
<input type="radio" name="zoom_and" value="0" checked="checked" />any search words
<input type="radio" name="zoom_and" value="1" />all search words
<input type="hidden" name="zoom_sort" value="0" />
<br /><br /></span>
</form>
<div class="searchheading">Search results for: undefined<br /><br /></div>
<div class="results">
<div class="summary">
No results found.<br />
</div>
</div>
Hope that can help
Leave a comment:
-
Can you post the URL to your search page so that we can see the problem.
Leave a comment:
Leave a comment: