Can you use asp.net to create search pages
Announcement
Collapse
No announcement yet.
Can you use asp.net to create search pages
Collapse
X
-
We don't have a ASP.NET version of the Zoom software as yet. At the moment there doesn't seem to be any advantage in moving to .NET.
But this doesn't stop you indexing and using Zoom on ASP.NET sites. You just need to make sure the .ASPX file extension is in the list of extensions to scan.
Our existing solutions (ASP & the Windows binary CGI) work on all the same platforms as .NET. So we wouldn't gain in compatibility by moving to .NET.
We also don't think there would be any gain in performance by using .NET. Our existing benchmarks are here,
http://www.wrensoft.com/zoom/benchmarks.html
So having .NET is really only useful to use from a marketing point of view (and not technical). But none the less we'll probably do a .NET version (probably C#.NET or C++.NET) eventually.
-
You can also embed the search results from either the ASP or CGI version into an ASPX (.NET) page, and we have some users who do this.
Take a look at this FAQ page for some information: http://www.wrensoft.com/zoom/support/faq_ssi.html
Although the above page has no code example for .NET at this stage (since there are many different languages you can use for .NET: C#, C++, etc.), the equivalent concepts would apply as to how you can implement this in .NET
Comment
-
Could you elaborate on how to use zoom search in ASP.Net?
I have an ASP.Net page that runs .NET code. I tried to 'embed' the search.asp page in the ASP.Net page using the #include directive. However, the compiler gives an error when the page runs. (which makes sense, actually because I don't imagine it can recognize ASP and ASP.Net code)
Is the workaround to use the CGI method? Or is there another trick you could share - perhaps a way to run the ASP code, return the results, and insert them into my ASP.Net page?
Thank you in advance. By the way, this is an excellent product!
Comment
-
Yes, you would need to be doing something similar to the CGI method, in which the ASPX wrapper would pass along all the parameters to the ASP script (or CGI), capture the output, and display it in context within the ASPX page. You can not use the #include method to do this. I should probably have linked specifically to this part of the support page:
http://www.wrensoft.com/zoom/support...i.html#ssi_cgi
Note that the search results are provided in XHTML 1.0 format, so you can even parse this and do some additional re-formatting if required.
Comment
-
Thank you. Here's some code for anyone else using asp.net
Hopefully this will help someone get started if they want to use the Zoom Search Engine with ASP.Net.
My main reason for not just building an ASP page is that I've built my site using User Controls as the header and side navigation bar, and I want those controls to appear on my search page.
Thanks to Ray's help, I got this working. I first put an ASP Literal tag in the spot where I wanted my search results to appear within my search.aspx page:
Code:<asp:Literal id="literalResults" runat="server" />
Code:Const SEARCH_PAGE = "search.cgi" Sub Page_Load literalResults.EnableViewState = False Call Page.Validate() If Page.IsValid Then Dim sVirtualPath As String = Request.Url.ToString.Substring(0, Request.Url.ToString.LastIndexOf("/") + 1) Dim sPageHTML As String = GetPage(sVirtualPath & SEARCH_PAGE) If sPageHTML = "" Then literalResults.Text = "Error - no results found" Else literalResults.Text = sPageHTML End If End If End Sub Function GetPage(ByVal sPageURL As String) 'Send Data Dim sPostData As String If InStr(Request.RawUrl, "?") Then sPostData = Request.RawUrl.Substring(Request.RawUrl.IndexOf("?") + 1) Else sPostData = "" End If Dim myRequest As HttpWebRequest = CType(WebRequest.Create(sPageURL & "?" & sPostData), HttpWebRequest) myRequest.Method = "GET" Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse) Dim myResponseStream As StreamReader = New StreamReader(myResponse.GetResponseStream()) Dim sPageHTML As String = myResponseStream.ReadToEnd() myResponse.Close() myResponseStream.Close() Return sPageHTML End Function
Comment
-
Originally posted by RayYes, you would need to be doing something similar to the CGI method, in which the ASPX wrapper would pass along all the parameters to the ASP script (or CGI), capture the output, and display it in context within the ASPX page. You can not use the #include method to do this. I should probably have linked specifically to this part of the support page:
http://www.wrensoft.com/zoom/support...i.html#ssi_cgi
Comment
-
I am not sure if this will solve your specific problem but we have now developed and tested a ASP.NET (ASPX) solution for use with Zoom.
All the details are here,
http://www.wrensoft.com/zoom/support/aspdotnet.html
Going forward, this will be the solution we recomend ASP.NET users to use with Zoom.
For general information about adding a search box to any page on your web site refer to section, 5.8 "How can I add a search form to my menus, main page", (page 42) of the users guide,
http://www.wrensoft.com/zoom/usersguide.html
----
David
Comment
-
I can get there to be a search page just fine, the problems I am having results from not being able to use the code supplied by you guys in your support pages to insert a search box in my aspx header. The only way I can get it to work is by using FromWrapper
http://www.structured-solutions.net/...SPNETPage.aspx
After that it does work fine on the page, but the control does not support having an image as a submit button... which I really need because of the nature of the site.
Comment
-
I think this is an ASP.NET web design issue and it would depend on the context of the ASPX page. I presume you have the form set to runat="server". This should not be necessary, and it is probably why you needed the wrapper (a form with runat="server" specified will ignore the action= attribute and always submit to itself ... which in your case, would have been header.aspx or something, and why it would not work).
More information here:
http://www.w3schools.com/aspnet/aspnet_forms.asp
We have tested an ASPX page with the HTML form we provided copy+pasted verbatim (with "search.php" replaced with "search.aspx"), and it worked as expected.
You might also want to take a look at this page, and see if you can use CSS to change your submit button to an image (there's an example given):
http://www.wrensoft.com/zoom/support/css.html
Comment
-
I actually didnt use runat=server. The problem most likely is that we have a form that "surrounds" the page (it is an error bot) so when pasting in the html form code in, it is nested within that larger form and does not work unless we use the form wrapper. Also, I am not using the cgi/aspx solution (because we have a hosted server running windows using IIS and have to ask them to change permissions and they have been slow about it).. I don't know if that would make a difference? I have it get an asp file. Do you think it would be more likely to work if we used the cgi within an aspx file?
also, the css only worked on the actual search page button, not the one in the header.. is there anything I need to insert into the button input tag?
Comment
-
so, i am having trouble installing the cgi script.. I get a file not found when I just try to go to the cgi script. I talked to my host and they wrote back with:
You are getting the exact behavior I would expect. The file is there, the permissions are set, it's marked executable. The problem is that there's nothing in IIS that's going to display / parse an executable file in a web browser. The file is not anything that IIS understands.
So, what do I need to do? im so confused now.
Comment
-
I am thinking that it is going to be hard to comment on your .NET code, when we don't have a copy of the code, nor the parser error messages that you see.
Can you make a simple example file (as short and as simple as possible) that shows the error in question. Someone may then be able to help you.
------
David
Comment
-
Solution using C#
Greetings,
Could you please post the code for this using C# ? I am having exactly the same situation as you : i.e my aspx search pages use web user controls for the header and the menus.
The code which you have mentioned, does it go along with the solution mentioned at http://www.wrensoft.com/zoom/support/aspdotnet.html or is this code to be completely omitted ?
Warm Regards,
~ Ashok
Originally posted by Anonymous View PostHopefully this will help someone get started if they want to use the Zoom Search Engine with ASP.Net.
My main reason for not just building an ASP page is that I've built my site using User Controls as the header and side navigation bar, and I want those controls to appear on my search page.
Thanks to Ray's help, I got this working. I first put an ASP Literal tag in the spot where I wanted my search results to appear within my search.aspx page:
Code:<asp:Literal id="literalResults" runat="server" />
Code:Const SEARCH_PAGE = "search.cgi" Sub Page_Load literalResults.EnableViewState = False Call Page.Validate() If Page.IsValid Then Dim sVirtualPath As String = Request.Url.ToString.Substring(0, Request.Url.ToString.LastIndexOf("/") + 1) Dim sPageHTML As String = GetPage(sVirtualPath & SEARCH_PAGE) If sPageHTML = "" Then literalResults.Text = "Error - no results found" Else literalResults.Text = sPageHTML End If End If End Sub Function GetPage(ByVal sPageURL As String) 'Send Data Dim sPostData As String If InStr(Request.RawUrl, "?") Then sPostData = Request.RawUrl.Substring(Request.RawUrl.IndexOf("?") + 1) Else sPostData = "" End If Dim myRequest As HttpWebRequest = CType(WebRequest.Create(sPageURL & "?" & sPostData), HttpWebRequest) myRequest.Method = "GET" Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse) Dim myResponseStream As StreamReader = New StreamReader(myResponse.GetResponseStream()) Dim sPageHTML As String = myResponseStream.ReadToEnd() myResponse.Close() myResponseStream.Close() Return sPageHTML End Function
Comment
Comment