|
Comments and Discussions
|
 |
|
 |
Downloaded the source code and put into the "C:\Inetpub\wwwroot\NormalSearch" folder
Step 1: I have created the Catalog in "C:\Inetpub\Catalog" folder as "Search"
Step 2: I have created the virtual directory in "C:\Inetpub\wwwroot\NormalSearch" folder
Step 3: Add the new index service "Service" and map directory with ""C:\Inetpub\wwwroot\NormalSearch"
Step 4: In Tracking WWWServer as "none" and check the generate abstract.
I want to search files only inside the "C:\Inetpub\wwwroot\NormalSearch" folder.In Query the catalog it is giving the correct result.
Modified the following Line in the code
this.dbConnection.ConnectionString = "Provider=MSIDXS.1;Integrated Security .=\"\";Data Source=Search";
But if i run the application it is always returning empty records please give the solution thanks.
Best of luck
|
|
|
|
 |
I am using the following code but need to not search a directory called "search_excluded" which is not at the root and I can't figure out how to do it.
Any help would be appreciated.
Code:
private string Command
{
get
{
// Construct the base query.
string query = String.Format(@" SELECT Rank, VPath, DocTitle, Filename, Characterization, Write FROM SCOPE('DEEP TRAVERSAL OF ""{0}""')
WHERE NOT CONTAINS(VPath, '""_vti_"" OR "".config""')", this.cboDirectory.SelectedItem.Value);
// Conditionally construct the rest of the WHERE clause.
string type = this.cboQueryType.SelectedItem.Value.ToLower();
string fmt = @" AND (CONTAINS('{0}') OR CONTAINS(DocTitle, '{0}'))";
Thanks
modified on Thursday, June 3, 2010 9:50 AM
|
|
|
|
 |
It would be treated the sape as the _vti_ directory, so add the following WHERE clause instead:
WHERE NOT CONTAINS(VPath, '""_vti_"" OR ""search_excluded"" OR "".config""')
This posting is provided "AS IS" with no warranties, and confers no rights.
Program Manager II
Visual Studio Professional Deployment Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
how can we search directories of catalog using indexing server with asp.net and c#.
plz send code asap
regards
venkat
venkat
|
|
|
|
 |
Is there a way with Indexing Service to designate where to start indexing each file. For example, I don't want the shared header in all of my files to be indexed because they will all contain the same text.
Also, the abstract limit can only be set to show a maximum of 500 characters (even when manually setting the registry value) Is there a known solution around this?
Thanks in advance
|
|
|
|
 |
I am searching ASPX pages. Within the pages includes meta content. The index server shows the ASPX pages but isnt producing abstracts. Does index server ignore ASPX pages? I am a little confused because I have had the search returning meta tag content from aspx pages.
|
|
|
|
 |
Your unprocessed page - the file on your hard disk - has to include content to be indexed and from which characterizations are generated. Index server works on the files on your disk, and is not a web crawler that looks at the server-processed pages.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
Will index server look at unprocessed aspx pages. Whats the best way to "include content to be indexed"?
|
|
|
|
 |
It's just content like you'd put in <p> tags and what-not; you know, regular content to display to the user.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
This is probably a very simple question. The links to the filename/title are not showing up as links. Any ideas what this might be? I sorted my other problem with posting to other pages btw, cheers for the help.
Andrew
|
|
|
|
 |
If the filename and title are returned in your search results, then make sure you're formatting your HTML correctly to display an <A> correctly, as shown above.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
Thats is not working. Even using your original code, its not working. here is my code: <form id="Default" method=post runat="server"> <p> <table style="font-size: 8pt; width: 310px; vertical-align: top; height: 204px;"> <tr> <td style="width: 2408px; height: 15px; color: black;"> <img style="border:none;" alt="Abtec Network Systems" src="images/house.gif"><a href="index.aspx" style="padding:3px;"><span style="color: black">Home</span></a><a><span style="color:gray;"> | </span></a><img style="border:none;" alt="Abtec Network Systems" src="images/sitemap_color.gif"><a href="sitemap.aspx" style="padding:3px;"><span style="color: black">Sitemap</span></a></td> <td style="width: 1479px; height: 15px"> </td> <td style="width: 123px; height: 15px"> </td> </tr> <tr> <td style="width: 2408px; height: 41px;"> <asp:label id=lblQuery runat="server" Width="100px"><img style="border: none;" alt="Abtec Network Systems" src="images/magnify.gif"><a style="padding: 3px;">Search</a></asp:label></td> <td style="width: 1479px; height: 41px;"> <asp:textbox id=txtQuery accessKey=Q runat="server" Width="100px" style="height: 17px; border: 1px solid #1c3f94;" ></asp:textbox></td> <td style="width: 123px; height: 41px;"> <asp:RequiredFieldValidator id=reqValQuery runat="server" ErrorMessage="RequiredFieldValidator" Display="Dynamic" ControlToValidate="txtQuery">You must specify a query.</asp:RequiredFieldValidator></td> </tr> <tr> <td style="width: 2408px"> <asp:label id=lblQueryType runat="server" Width="100px">Query Type:</asp:label></td> <td style="width: 1479px"> <asp:dropdownlist id=cboQueryType accessKey=T runat="server" Width="100px" style="height: 17px; border: 1px solid #1c3f94;" > <asp:ListItem Value="All" Selected="True">All Words</asp:ListItem> <asp:ListItem Value="Any">Any Words</asp:ListItem> <asp:ListItem Value="Boolean">Boolean Expression</asp:ListItem> <asp:ListItem Value="Exact">Exact Expression</asp:ListItem> <asp:ListItem Value="Natural">Natural Language</asp:ListItem> </asp:dropdownlist></td> <td style="width: 123px"> </td> </tr> <tr> <td style="width: 2408px"> <asp:label id=lblDirectory runat="server" Width="100px">Directory:</asp:label></td> <td style="width: 1479px"> <asp:dropdownlist id=cboDirectory accessKey=D runat="server" Width="100px"> <asp:ListItem Value="/" Selected="True">Entire Site</asp:ListItem> <asp:ListItem Value="/casestudies">Case Studies</asp:ListItem> </asp:dropdownlist></td> <td style="width: 123px"> </td> </tr> <tr> <td style="width: 2408px"> <asp:label id=lblSortOrder runat="server" Width="100px">Sort Order:</asp:label></td> <td style="width: 1479px"> <asp:dropdownlist id=cboSortBy accessKey=S runat="server" Width="100px"> <asp:ListItem Value="Rank" Selected="True">Search Rank</asp:ListItem> <asp:ListItem Value="DocTitle">Document Title</asp:ListItem> <asp:ListItem Value="Write">Last Modified</asp:ListItem> </asp:dropdownlist></td> <td style="width: 123px"> </td> </tr> <tr> <td style="width: 2408px"> </td> <td style="width: 1479px"> <asp:dropdownlist id=cboSortOrder runat="server" Width="100px"> <asp:ListItem Value="ASC" Selected="True">Ascending</asp:ListItem> <asp:ListItem Value="DESC">Descending</asp:ListItem> </asp:dropdownlist></td> <td style="width: 123px"> </td> </tr> <tr> <td style="width: 2408px"> </td> <td style="width: 1479px"> Please click search to submit</td> <td style="width: 123px"> <asp:button id=btnSearch runat="server" Text="Search" onclick="btnSearch_Click" style="height: 20px; font-size: 8pt; background-color: #1c3f94; border: none; color: white;"></asp:button><input type="text" style="visibility:hidden; position:absolute" /></td> </tr> <tr> <td style="height: 45px;" colspan="3"> <asp:label id=lblResultCount runat="server" Font-Italic="True" visible="False">X documents were found:</asp:label></td> </tr> </table>
</p> </div>
</div>
</div> </div> <div style="width:600px; height:10px;"> <br /> <asp:datagrid id=dgResultsGrid runat="server" AllowPaging="True" AutoGenerateColumns="False" Visible="False" Font-Size="8pt" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" PageSize="5" Width="100%"> <itemstyle horizontalalign="Left" verticalalign="Top" BackColor="White" ForeColor="Black"> </ItemStyle> <headerstyle font-bold="True" ForeColor="White"> </HeaderStyle> <columns> <asp:TemplateColumn HeaderText="<h2>Rank</h2>"> <headerstyle width="60px"> </HeaderStyle> <itemtemplate> <asp:Label id=Label1 runat="server" Text='<%# ((int)DataBinder.Eval(Container, "DataSetIndex")) + 1 %>'></asp:Label> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="<h2>Document Information</h2>"> <itemstyle horizontalalign="Left" verticalalign="Top"> </ItemStyle> <itemtemplate> <p> <h3 style="text-transform:uppercase; margin-bottom:-5px;"> <asp:hyperlink ID="Hyperlink1" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "VPath")%>'> <%# GetTitle(Container.DataItem)%> </asp:hyperlink> </h3> <br> <asp:label ID="Label2" runat="server"><%# GetCharacterization(Container.DataItem)%></asp:label><br> <i><asp:hyperlink ID="Hyperlink2" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "VPath")%>'>http://<%# Request.ServerVariables["SERVER_NAME"]%><%# DataBinder.Eval(Container.DataItem, "VPath")%></asp:hyperlink> - Last Modified: <asp:label ID="Label3" runat="server"><%# DataBinder.Eval(Container.DataItem, "Write")%></asp:label></i></p> </ItemTemplate> </asp:TemplateColumn> </Columns> <pagerstyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" Mode="NumericPages"> </PagerStyle> <FooterStyle BackColor="White" ForeColor="Black" /> <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <AlternatingItemStyle BackColor="White" /> </asp:datagrid></div> </form> Thanks in advance for the help.
|
|
|
|
 |
Sorted that now. It was to do with index server settings.
|
|
|
|
 |
Hi,
What is the best way of doing this? I have tried a couple of different ways but I cant seem to get the search to activate when I post the search term to the page from another. Im a bit stuck. Does anyone have any code for this? Thanks
Andrew Welch
|
|
|
|
 |
In the handler for Page.Load , for example, use the HttpRequest.Item property via the Page.Request property:string fname = Request.Form["fname"];
string lname = Request.Form["lname"]; You could also use either the HttpRequest.QueryString property for GET or HttpRequest.Form for POST.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
Hi, This is what i am doing at the moment. -------------------------------------------------------------- On my master page. I have a text box and button with the code: <asp:TextBox ID="txtSearch" Columns="12" style="height: 17px; border: 1px solid #1c3f94;" runat="server"></asp:TextBox> <asp:Button ID="btnSearch" runat="server" Text="Go!" style="height: 20px; font-size: 8pt; background-color: #1c3f94; border: none; color: white;" OnClick="btnSearch_Click" /> -------------------------------------------------------------- In the code behind of the master page I have: Partial Class MasterPage Inherits System.Web.UI.MasterPage
Sub btnSearch_Click(ByVal s As Object, ByVal e As EventArgs) Server.Transfer("SiteSearch.aspx", True) End Sub End Class -------------------------------------------------------------- This sitesearch.aspx page is as follows: <%@ Page language="c#" Inherits="Search._Default" CodeFile="SiteSearch.aspx.cs" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html> <head> <title>Search</title> <meta content="Microsoft Visual Studio 7.0" name=GENERATOR> <meta content=C# name=CODE_LANGUAGE> <meta content=JavaScript name=vs_defaultClientScript> <meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div style="width:100%;height:90px;"> <img src="Images/commssolutionbanner.gif" style="float: right" /> <a href="index.aspx"><img src="Images/topleftabteclogo.gif" style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none" /></a><a href="index.aspx">HOME</a></div> <form id=Default method=post runat="server"> <p><asp:label id=lblQuery runat="server" Width="100px">Query:</asp:label><asp:textbox id=txtQuery accessKey=Q runat="server" Width="300px"></asp:textbox><asp:RequiredFieldValidator id=reqValQuery runat="server" ErrorMessage="RequiredFieldValidator" Display="Dynamic" ControlToValidate="txtQuery">You must specify a query.</asp:RequiredFieldValidator><br><asp:label id=lblQueryType runat="server" Width="100px">Query Type:</asp:label><asp:dropdownlist id=cboQueryType accessKey=T runat="server" Width="300px"> <asp:ListItem Value="All" Selected="True">All Words</asp:ListItem> <asp:ListItem Value="Any">Any Words</asp:ListItem> <asp:ListItem Value="Boolean">Boolean Expression</asp:ListItem> <asp:ListItem Value="Exact">Exact Expression</asp:ListItem> <asp:ListItem Value="Natural">Natural Language</asp:ListItem> </asp:dropdownlist><br><asp:label id=lblDirectory runat="server" Width="100px">Directory:</asp:label><asp:dropdownlist id=cboDirectory accessKey=D runat="server" Width="300px"> <asp:ListItem Value="/" Selected="True">Entire Site</asp:ListItem> <asp:ListItem Value="/Products">Products</asp:ListItem> <asp:ListItem Value="/Products/App1">Products: App1</asp:ListItem> <asp:ListItem Value="/Products/App2">Products: App2</asp:ListItem> <asp:ListItem Value="/Services">Services</asp:ListItem> <asp:ListItem Value="/Help">Help</asp:ListItem> </asp:dropdownlist><br><asp:label id=lblSortOrder runat="server" Width="100px">Sort Order:</asp:label><asp:dropdownlist id=cboSortBy accessKey=S runat="server" Width="135px"> <asp:ListItem Value="Rank" Selected="True">Search Rank</asp:ListItem> <asp:ListItem Value="DocTitle">Document Title</asp:ListItem> <asp:ListItem Value="Write">Last Modified</asp:ListItem> </asp:dropdownlist><asp:dropdownlist id=cboSortOrder runat="server" Width="100px"> <asp:ListItem Value="ASC" Selected="True">Ascending</asp:ListItem> <asp:ListItem Value="DESC">Descending</asp:ListItem> </asp:dropdownlist><asp:button id=btnSearch runat="server" Text="Search" onclick="btnSearch_Click"></asp:button> Please click search to submit</p> <p><asp:label id=lblResultCount runat="server" Font-Italic="True" visible="False">X documents were found:</asp:label></p> <p><asp:datagrid id=dgResultsGrid runat="server" PageSize="25" AllowPaging="True" AutoGenerateColumns="False" Visible="False" Font-Size="8pt" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical"> <itemstyle horizontalalign="Left" verticalalign="Top" BackColor="#EEEEEE" ForeColor="Black"> </ItemStyle> <headerstyle font-bold="True" BackColor="#000084" ForeColor="White"> </HeaderStyle> <columns> <asp:TemplateColumn HeaderText="Rank"> <headerstyle width="60px"> </HeaderStyle> <itemtemplate> <asp:Label id=Label1 runat="server" Text='<%# ((int)DataBinder.Eval(Container, "DataSetIndex")) + 1 %>'></asp:Label> </ItemTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="Document Information"> <itemstyle horizontalalign="Left" verticalalign="Top"> </ItemStyle> <itemtemplate> <p><asp:hyperlink runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "VPath")%>'><%# GetTitle(Container.DataItem)%></asp:hyperlink><br> <asp:label runat="server"><%# GetCharacterization(Container.DataItem)%></asp:label><br> <i><asp:hyperlink runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "VPath")%>'>http://<%# Request.ServerVariables["SERVER_NAME"]%><%# DataBinder.Eval(Container.DataItem, "VPath")%></asp:hyperlink> - Last Modified: <asp:label runat="server"><%# DataBinder.Eval(Container.DataItem, "Write")%></asp:label></i></p> </ItemTemplate> </asp:TemplateColumn> </Columns> <pagerstyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" Mode="NumericPages"> </PagerStyle> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <AlternatingItemStyle BackColor="#DCDCDC" /> </asp:datagrid></p></form> </body> </html> -------------------------------------------------------------- And the sitesearch.aspx.cs codebehind is: using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace Search { /// <summary> /// Summary description for _Default. /// </summary> public partial class _Default : System.Web.UI.Page { protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1; protected System.Data.OleDb.OleDbDataAdapter dbAdapter; protected System.Data.OleDb.OleDbConnection dbConnection; protected void Page_Load(object sender, System.EventArgs e) { string strSearch = Request.Form["txtSearch"]; if (IsPostBack == false) { if (!(strSearch.Equals(string.Empty))) { this.txtQuery.Text = strSearch; this.Search(); } } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dbAdapter = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.dbConnection = new System.Data.OleDb.OleDbConnection(); this.dgResultsGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.dgResultsGrid_PageIndexChanged); // // dbAdapter // this.dbAdapter.SelectCommand = this.oleDbSelectCommand1; // // oleDbSelectCommand1 // this.oleDbSelectCommand1.Connection = this.dbConnection; // // dbConnection // this.dbConnection.ConnectionString = "Provider=MSIDXS.1;Integrated Security .=\"\";Data Source=abtecwebsitesearch"; } #endregion protected void btnSearch_Click(object sender, System.EventArgs e) { this.Search(); } private void dgResultsGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { // Update the current page index. this.dgResultsGrid.CurrentPageIndex = e.NewPageIndex; this.Search(); } /// <summary> /// Gets the command string for the search. /// <seealso cref="Search"/> /// </summary> private string Command { get { // Construct the base query. string query = String.Format(@" SELECT Rank, VPath, DocTitle, Filename, Characterization, Write FROM SCOPE('DEEP TRAVERSAL OF ""/abtecwebsite/""') WHERE NOT CONTAINS(VPath, '""_vti_"" OR "".config""')", this.cboDirectory.SelectedItem.Value); // Conditionally construct the rest of the WHERE clause. string type = this.cboQueryType.SelectedItem.Value.ToLower(); string fmt = @" AND (CONTAINS('{0}') OR CONTAINS(DocTitle, '{0}'))"; // Get the query string and remove all semi-colons, which should stop // attempt to run malicious SQL code. string text = this.txtQuery.Text.Replace(";", ""); if (type == "all" || type == "any" || type == "boolean") { string[] words = text.Split(' '); int len = words.Length; for (int i=0; i<len; i++) { string word = words[i]; if (type == "boolean") if (String.Compare(word, "and", true) == 0 || String.Compare(word, "or", true) == 0 || String.Compare(word, "not", true) == 0 || String.Compare(word, "near", true) == 0) continue; words[i] = String.Format(@"""{0}""", word); if (i < len - 1) { if (type == "all") words[i] += " AND"; else if (type == "any") words[i] += " OR"; } } query += String.Format(fmt, String.Join(" ", words)); } else if (type == "exact") { query += String.Format(fmt, text); } else if (type == "natural") { query += String.Format(" AND FREETEXT('{0}')", text); } // Sort the results. query += String.Format(" ORDER BY {0} {1}", this.cboSortBy.SelectedItem.Value, this.cboSortOrder.SelectedItem.Value); Trace.Write("Query", query); return query; } } /// <summary> /// Perform the search. /// </summary> private void Search() { // Create a new DataSet and fill it. try { this.dbAdapter.SelectCommand.CommandText = Command; DataSet ds = new DataSet("Results"); this.dbAdapter.Fill(ds); this.lblResultCount.ForeColor = Color.Black; int rows = ds.Tables[0].Rows.Count; this.lblResultCount.Text = String.Format("{0} document{1} found{2}", rows, rows == 1 ? " was" : "s were", rows == 0 ? "." : ":"); // Bind the resulting DataSet. this.dgResultsGrid.DataSource = ds; this.dgResultsGrid.DataBind(); // If all was bound well, display the DataGrid. this.dgResultsGrid.Visible = (rows > 0); } catch (Exception ex) { this.lblResultCount.ForeColor = Color.Red; this.lblResultCount.Text = String.Format("Unable to retreive a list " + "of documents for the specified query: {0}", ex.Message); this.dgResultsGrid.Visible = false; } finally { this.lblResultCount.Visible = true; } } /// <summary> /// Get the appropriate title from the <see cref="DataGridItem.DataItem"/> /// bound to the <see cref="DataGrid"/>. /// </summary> /// <param name="value">A <see cref="DataGridItem.DataItem"/> for the current record.</param> /// <returns>Either the "DocTitle" or "Filename" respectively.</returns> protected object GetTitle(object value) { string title = DataBinder.Eval(value, "DocTitle") as string; if (title != null && title.Length > 0) return title; return DataBinder.Eval(value, "Filename"); } /// <summary> /// Encodes the characterization since some malformed text could cause /// the web browser to not render the remaining elements. /// </summary> /// <param name="value">A <see cref="DataGridItem.DataItem"/> for the current record.</param> /// <returns>The encoded characterization.</returns> protected string GetCharacterization(object value) { return Server.HtmlEncode(DataBinder.Eval(value, "Characterization") as string); } } } -------------------------------------------------------------- I am getting an error of: Server Error in '/' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error:
Line 29: if (IsPostBack == false) Line 30: { Line 31: if (!(strSearch.Equals(string.Empty))) Line 32: { Line 33: this.txtQuery.Text = strSearch; Source File: c:\Inetpub\Test Abtec Website\SiteSearch.aspx.cs Line: 31 Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Search._Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\Test Abtec Website\SiteSearch.aspx.cs:31 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
|
|
|
|
 |
Using Server.Transfer is not correct. Please read the documentation of the method. It completely transfers execution to another page as if the user was still on the same page. That won't post the form data. You simple need to put the SiteSearch.aspx page as the form's action. That's actually old-school form submittal.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
So I post the sitesearch.aspx page as the form action using the methods you previously referred to?
In the handler for Page.Load, for example, use the HttpRequest.Item property via the Page.Request property:
(This is the page_load of the sitesearch.aspx page i presume)
string fname = Request.Form["fname"];string lname = Request.Form["lname"];
(This refers to the formname on the text box search and the label of the search string on the sitesearch page?)
You could also use either the HttpRequest.QueryString property for GET or HttpRequest.Form for POST
(This relates to the method posting from the text box search?)
Thanks
Andrew
|
|
|
|
 |
Correct. Request.Form will get key/value pairs POST'd or GET'd to SiteSearch.aspx but POST'ing and GET'ing are simple HTTP protocols that pre-date anything ASP.NET brings to the table. So, your <form> just has the action to go to another page. You might consider using GET as the method so that users can bookmark search results and won't get a prompt to "Post search results again?" if they click on a result link, then hit the brower's back button.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
I have created my form. It is in a master page as you can see from the code I posted before. However, when I click the button it just posts back the same page? Any ideas? <form method="get" action="sitesearch.aspx"> <input type="text" name="search"/> <input type="submit" value="Go!" style="height: 20px; font-size: 8pt; background-color: #1c3f94; border: none; color: white;"/></form> Below is the bit of code form the sitesearch code behind page_load: protected void Page_Load(object sender, System.EventArgs e) { string strSearch = ""; strSearch = Request.Form["search"]; if (IsPostBack == false) { this.txtQuery.Text = strSearch; this.Search(); } } Can you see a problem with that? Thanks Andrew
|
|
|
|
 |
How is the server form (ASP.NET supports 1 and only 1 currently) nested in relation to this client form?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
The master page has a <form runat="server"></form> wrapping around the body content. This is the index page of my website which doesnt use master pages (note I have removed the server.transfer code and replace it with a PostBackUrl in the asp:button tag. This method works and returns search results from the sitesearch.aspx page.)-- ----------------------------------------------------------------------- <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <!-- Styles for drop downs --> <style type="text/css"> ul { margin: 0; padding: 0; list-style: none; } ul li { position: relative; float: left; width:70px; } li ul { position: absolute; left: 0; /* Set 1px less than menu width */ top: auto; display: none; } /* Styles for Menu Items */ ul li a { display: block; text-decoration: none; background:white; /*; IE6 Bug */ padding: 5px; } /* set dropdown to default */ li:hover li a, li.over li a { color: #777; background-color:#fff; } li ul li a { padding: 2px 5px; } /* Sub Menu Styles */ li:hover ul, li.over ul { display: block;} /* The magic */ </style> <!-- Styles for drop downs ends --> <!-- Javascript for drop downs --> <script type="text/javascript"> // JavaScript Document startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; </script> <!-- Javascript for drop downs ends--> <!-- Javascript for flash object --> <script type="text/javascript" src="javascript/flashobject.js"></script> <!-- Javascript for flash object ends--> <link href="stylesheet1.css" type="text/css" rel="stylesheet"> <title>Welcome to Abtec Network Systems - Complete Communications and Business Network Solutions</title> <meta content="history, abtec, network solutions, communication solutions, small businessnetworks, pc firewall, network security, LAN, WAN, Wireless, network maintanence, technical support, business network solution" name="keywords">
<meta content="Abtec network systems provides the complete network, business network and communications solutions specalising in telephone systems, network installation and maintenance, LAN, WAN, Wireless and security solutions" name="description"> </head> <body>
<!-- Top CSS content on page --> <div style="width: 660px; height: 200px;"> <div style="float: left;"> <a href="index.aspx"> <img style="border: none;" alt="Abtec Network Systems" src="images/topleftabteclogo.gif"> </a> </div> <div style="float: left;width: 545px; height: 20px; text-align: left; margin-left:20px;"> <!-- Mini navigation start --> <div class="navig1" style=""> <table> <tr> <td style="height: 16px"><img style="border:none;" alt="abtec network systems" src="images/email.gif"><a href="contact.aspx" style="padding:3px;">Contact</a></td> <td style="height: 16px"><img style="border:none;" alt="Find out about Abtec" src="images/information.gif"><a href="aboutus.aspx" style="padding:3px;">About Us</a></td> <td style="height: 16px"><img style="border:none;" alt="Find out about Abtec" src="images/information.gif"><a href="supportform.aspx" style="padding:3px;">Enquiry</a></td> <td style="height: 16px"><img style="border:none;" alt="Find out about Abtec" src="images/user.gif"><a href="careers.aspx" style="padding:3px;">Careers</a></td> </tr> </table> </div> <!-- Mini navigation end --> </div> <!-- Search and navigation module start -->
<!-- Search Module --> <div> <div style="float:left; margin-left:20px;"> <div style="height:0px;text-align: right; width:419px; background-color:lavender; background: url(images/custom_corners_topleft.gif) top left no-repeat;"> <div style="float:left;padding:3px 0px 0px 4px; height:10px; "> <img style="border:none;" alt="Abtec Network Systems" src="images/house.gif"><a href="index.aspx" style="padding:3px;">Home</a><a><span style="color:gray;"> | </span></a><img style="border:none;" alt="Abtec Network Systems" src="images/sitemap_color.gif"><a href="sitemap.aspx" style="padding:3px;">Sitemap</a> </div> <form runat="server"> <div style="float:left;width:288px; margin-bottom:-23px; height:50px;border-bottom:1px solid silver; padding:3px 8px 0px 0px;background-color:;text-align:right; background: url(images/custom_corners_topright.gif) top right no-repeat;margin-right:-10px;"> <img style="border: none;" alt="Abtec Network Systems" src="images/magnify.gif"><a style="padding: 3px;">Search</a> <asp:TextBox ID="txtSearch" Columns="12" style="height: 17px; border: 1px solid #1c3f94;" runat="server"></asp:TextBox> <asp:Button ID="btnSearch" PostBackUrl="~/SiteSearch.aspx" runat="server" Text="Go!" style="height: 20px; font-size: 8pt; background-color: #1c3f94; border: none; color: white;"/> </form> </div> <!-- Search Module ends -->
<!-- Drop down boxes navigation -->
<div id="navig" style=""> <ul id="nav"> <li><a href="aboutus.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;">About Us</a> <ul> <li><a href="accreditations.aspx" style="width: 100px; font-size:8pt;">Accreditations</a></li> <li><a href="history.aspx" style="width: 100px; font-size: 8pt;">History</a></li> <li><a href="partners.aspx" style="width: 100px; font-size:8pt;">Partners</a></li> </ul> </li> <li><a href="services.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;"><span>Services</span></a> <ul> <li><a href="services.aspx#consultancy" style="width: 110px; font-size: 8pt;">Consultancy</a></li> <li><a href="services.aspx#design" style="width: 110px; font-size: 8pt;">Design</a></li> <li><a href="services.aspx#installation" style="width: 110px; font-size: 8pt;">Installation</a></li> <li><a href="services.aspx#maintenance" style="width: 110px; font-size: 8pt;">Maintenance</a></li> <li><a href="brokerage.aspx" style="width: 110px; font-size: 8pt;">Brokerage</a></li> </ul> <li><a href="solutions.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;"><span>Solutions</span></a> <ul> <li><a href="wan.aspx" style="width: 190px; font-size: 8pt;">Wide Area Networking</a></li> <li><a href="lan.aspx" style="width: 190px; font-size: 8pt;">Local Area Networking & Servers</a></li> <li><a href="telefunky.aspx" style="width: 190px; font-size: 8pt;">Telephony</a></li> <li><a href="security.aspx" style="width: 190px; font-size: 8pt;">Security</a></li> <li><a href="wireless.aspx" style="width: 190px; font-size: 8pt;">Wireless</a></li> <li><a href="smb.aspx" style="width: 190px; font-size: 8pt;">SMB</a></li> <li><a href="ent.aspx" style="width: 190px; font-size: 8pt;">Enterprise</a></li> </ul> </li> <li><a href="support.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;">Support</a> <ul> <li><a href="supportoptions.aspx" style="width: 110px; font-size: 8pt;">Support Options</a></li> <li><a href="supportform.aspx" style="width: 110px; font-size: 8pt;" >Support Enquiry</a></li> <li><a href="supportboltons.aspx" style="width: 110px; font-size: 8pt;" >Support Bolt-Ons</a></li> </ul> </li> <li><a href="portfolio.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;">Portfolio</a> <ul> <li><a href="casestudies.aspx" style="width: 100px; font-size: 8pt;">Case Studies</a></li> </ul> </li> <li><a href="news.aspx" style="font-weight: bold; background:transparent;border:0px solid silver;color:white;">News</a> <ul> <li><a href="newsarchive.aspx" style="width: 100px; font-size: 8pt;">Archive</a></li> </ul> </li> </ul> </div> </div> </div> <!-- Drop down boxes navigation ends-->
<!-- Search and navigation module end -->
<div style="float: left; width: 565px;"> </div>
<div style="border-left: 1px solid silver; border-top: 1px solid silver;border-bottom: 1px solid silver;float: left; width: 476px; height: 169px;"> <div id="flashcontent"><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">If you can see this text you need to upgrade your version of flash. Please click here to visit the Macromedia site and download the latest plugin.</a><br /> <br /> <div style="text-align: center;"><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><img style="border: 0px solid ; width: 100px; height: 41px;" alt="Get the latest FLASH plugin" src="images/flashbutton.gif"></a> </div> <script type="text/javascript">var fo = new FlashObject("images/banner1.swf", "mymovie", "476", "167", "7", "#ffffff"); fo.addParam("loop", "true"); fo.addParam("scale", "exactfit"); fo.addParam("WMODE", "opaque"); fo.write("flashcontent"); </script></div> </div> <div style="background: transparent none repeat scroll 0%; float: right; width: 181px; height: 80px; border-top: 1px solid silver; border-left: 1px solid silver; border-right : 1px solid silver;"> <a href="smb.aspx"><img style="border: 0px solid ; width: 181px; height: 80px;" alt="" src="images/smb1.gif"></a></div> <div style="border: 1px solid silver; background: transparent none repeat scroll 0%; float: right; width: 181px; height: 82px; padding-top: 2px; padding-bottom: 2px;border-top: 1px solid silver; border-left: 1px solid silver;border-right : 1px solid silver;"> <a href="ent.aspx"><img title="ent" style="border: 0px solid ; width: 181px; height: 82px;" alt="" src="images/ent.gif"></a></div> <div style="float: left; width: 212px; height: 400px; background-color:;border-bottom: 1px solid silver;border-bottom: 1px solid gray; border-left:1px solid silver;text-align:left;padding : 5px 0px 0px 10px;"> <h1>Welcome</h1> <p>This is the website of Abtec Network Systems. We provide the complete communications solution from servers to telephony, design, installation, maintenance and support.</p> <img src="images/arrowicon.gif" style="border:none;"><a href="aboutus.aspx" style="padding:3px;">Read more about Abtec...</a> <h1>Accreditations</h1> <p>Abtec has gained many accreditations and industry partners.</p> <p><a href="accreditations.aspx"><img src="images/accredsfrontpage.gif" style="border:none;"></a></p> <img src="images/arrowicon.gif" style="border:none;"><a href="accreditations.aspx" style="padding:3px;">View more ...</a> </div> <div style="float: left; width: 243px; height: 400px;background-color:;border-bottom: 1px solid silver;border-bottom: 1px solid gray; border-left:1px solid silver;text-align:left;padding : 5px 0px 0px 10px;"> <h1>What's New</h1> <h3>FEATURE 1</h3> Blah blah please put a really interesting feature here on something that is new with Abtec. <h3>FEATURE 2</h3> Blah blah please put another really interesting feature here on something that is new with Abtec. <h1>Testimonials</h1> <p>"Abtec are big enough to do the job, but small enough to care." - <i>Steve Lord, IT Manager- Chandlers Farm Equipment</i></p> <p>"It has brought our entire communications system up to date, improved efficiency and reduced costs." - <i>Paul Armstrong, Financial Director - Thomas Armstrong PLC</i></p> <img src="images/arrowicon.gif" style="border:none;"><a href="portfolio.aspx" style="padding:3px;">View more ...</a> </div> <div style="border-right : 1px solid silver;border-bottom: 1px solid silver;border-bottom: 1px solid gray;border-left:1px solid silver;float: left; width: 170px; height: 400px; text-align:left;padding : 5px 0px 0px 10px; text-align:left;"> <h3>CONTACT US</h3> Abtec Network Systems<br /> The Mill, Great Bowden Road<br /> Market Harborough<br /> Leicestershire<br /> LE16 7DE<br /> <br /> Tel: 0870 7874 500 <br /> Email: <a href="mailto:[email protected]"><span style="font-weight: bold;">[email protected]</span></a><br /> <a href="contact.aspx"></a><br /> <img src="images/arrowicon.gif" style="border:none;"><a href="supportform.aspx" style="padding:3px;">Make an Enquiry</a><br /><br /> <img src="images/arrowicon.gif" style="border:none;"><a href="map.aspx" style="padding:3px;">View map and directions</a> <br /><br /> <h1>Customer of the Month</h1> <p>Each month we showcase a customer</p> <img src="images/salvesen.gif"> </div>
<div class="logo" style="float: right; margin-top: 5px; margin-right: 5px;"><img alt="Abtec working with BT" src="images/BT_workingwith_websmall.gif"></div>
<div class="footer"> © Abtec 2006 <a href="disclaimer.aspx">Disclaimer </a> </div> </div> </body> </html>
----------------------------------------------------------------------- ----------------------------------------------------------------------- -----------------------------------------------------------------------
Below is the code from my master page. I have removed the server.transfer code for that and just using postback url as above in the asp:button tag. This however, posts to the search page but doesnt seem to pass the search phrase and therefore the sitesearch.aspx page posts the error: "Unable to retreive a list of documents for the specified query: The query contained only ignored words." ----------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <asp:contentplaceholder id="ContentPlaceHolder3" runat="server"> </asp:contentplaceholder> <style type="text/css"> ul { margin: 0; padding: 0; list-style: none; } ul li { position: relative; float: left; width:70px; } li ul { position: absolute; left: 0; /* Set 1px less than menu width */ top: auto; display: none; } /* Styles for Menu Items */ ul li a { display: block; text-decoration: none; background:white; /*; IE6 Bug */ padding: 5px; } /* set dropdown to default */ li:hover li a, li.over li a { color: #777; background-color:#fff; } li ul li a { padding: 2px 5px; } /* Sub Menu Styles */ li:hover ul, li.over ul { display: block;} /* The magic */ </style> <script type="text/javascript"> // JavaScript Document startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; </script> <script type="text/javascript" src="javascript/flashobject.js"></script> <script language="javascript" type="text/javascript" src="javascript/datetimepicker.js"> //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com //Script featured on JavaScript Kit (http://www.javascriptkit.com) //For this script, visit http://www.javascriptkit.com </script> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head> <body leftmargin="0" topmargin="0" bottommargin="10"> <form id="form1" runat="server" onclick="return form1_onclick()"> <div> <div style="height: 100px;"> <div style="position: absolute; left: 180px; top: 40px; text-align: right; width: 419px; background-color: lavender; background: url(images/custom_corners_topleft.gif) top left no-repeat;"> <div style="height: 40px; float: left; padding: 3px 0px 0px 4px;"> <img style="border: none;" alt="Abtec Network Systems" src="images/house.gif"><a href="index.aspx" style="padding: 3px;">Home</a> <a><span style="color: gray;">| </span> </a> <img style="border: none;" alt="Abtec Network Systems" src="images/sitemap_color.gif"><a href="sitemap.aspx" style="padding: 3px;">Sitemap</a></div> <div style="float: left; width: 288px; height: 47px; border-bottom: 1px solid silver; padding: 3px 8px 0px 0px; background-color: silver; text-align: right; background: url(images/custom_corners_topright.gif) top right no-repeat; margin-right: -10px;"> <img style="border: none;" alt="Abtec Network Systems" src="images/magnify.gif"><a style="padding: 3px;">Search</a> <asp:TextBox ID="txtSearch" Columns="12" style="height: 17px; border: 1px solid #1c3f94;" runat="server"></asp:TextBox> <asp:Button ID="btnSearch" PostBackUrl="~/SiteSearch.aspx" runat="server" Text="Go!" style="height: 20px; font-size: 8pt; background-color: #1c3f94; border: none; color: white;"/> </div> </div> <div style="position: absolute; left: 10px; top: 5px; text-align: left;"> <a href="index.aspx"> <img style="border: 0px solid;" alt="Abtec Network Systems" src="images/topleftabteclogo.gif"></a></div> <div style="position: absolute; right: 10px; top: 10px; text-align: right;"> <img alt="Abtec Network Systems" src="images/commssolutionbanner.gif"> </div> <div id="navig" style="position: absolute; left: 180px; top: 69px;"> <ul id="nav"> <li><a href="aboutus.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;">About Us</a> <ul> <li><a href="accreditations.aspx" style="width: 100px; font-size: 8pt;">Accreditations</a></li> <li><a href="history.aspx" style="width: 100px; font-size: 8pt;">History</a></li> <li><a href="partners.aspx" style="width: 100px; font-size: 8pt;">Partners</a></li> </ul> </li> <li><a href="services.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;"><span>Services</span></a> <ul> <li><a href="services.aspx#consultancy" style="width: 110px; font-size: 8pt;">Consultancy</a></li> <li><a href="services.aspx#design" style="width: 110px; font-size: 8pt;">Design</a></li> <li><a href="services.aspx#installation" style="width: 110px; font-size: 8pt;">Installation</a></li> <li><a href="services.aspx#maintenance" style="width: 110px; font-size: 8pt;">Maintenance</a></li> <li><a href="brokerage.aspx" style="width: 110px; font-size: 8pt;">Brokerage</a></li> </ul> <li><a href="solutions.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;"><span>Solutions</span></a> <ul> <li><a href="wan.aspx" style="width: 190px; font-size: 8pt;">Wide Area Networking</a></li> <li><a href="lan.aspx" style="width: 190px; font-size: 8pt;">Local Area Networking & Servers</a></li> <li><a href="telefunky.aspx" style="width: 190px; font-size: 8pt;">Telephony</a></li> <li><a href="security.aspx" style="width: 190px; font-size: 8pt;">Security</a></li> <li><a href="wireless.aspx" style="width: 190px; font-size: 8pt;">Wireless</a></li> <li><a href="smb.aspx" style="width: 190px; font-size: 8pt;">SMB</a></li> <li><a href="ent.aspx" style="width: 190px; font-size: 8pt;">Enterprise</a></li> </ul> </li> <li><a href="support.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;">Support</a> <ul> <li><a href="supportoptions.aspx" style="width: 110px; font-size: 8pt;">Support Options</a></li> <li><a href="supportform.aspx" style="width: 110px; font-size: 8pt;">Support Enquiry</a></li> <li><a href="supportboltons.aspx" style="width: 110px; font-size: 8pt;">Support Bolt-Ons</a></li> </ul> </li> <li><a href="portfolio.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;">Portfolio</a> <ul> <li><a href="casestudies.aspx" style="width: 100px; font-size: 8pt;">Case Studies</a></li> </ul> </li> <li><a href="news.aspx" style="font-weight: bold; background: transparent; border: 0px solid silver; color: white;">News</a> <ul> <li><a href="newsarchive.aspx" style="width: 100px; font-size: 8pt;">Archive</a></li> </ul> </li> </ul> </div> </div> <div class="navig1" style="left: 180px; top: 10px"> <table> <tbody> <tr> <td style="height: 16px"> <img style="border: none;" alt="abtec network systems" src="images/email.gif"> <a href="contact.aspx" style="padding: 3px;">Contact</a></td> <td style="height: 16px"> <img style="border: none;" alt="Find out about Abtec" src="images/information.gif"> </a> <a href="aboutus.aspx" style="padding: 3px;">About Us</a></td> <td style="height: 16px"> <img style="border: none;" alt="Find out about Abtec" src="images/information.gif"></a> <a href="supportform.aspx" style="padding: 3px;">Enquiry</a></td> <td style="height: 16px"> <img style="border: none;" alt="Find out about Abtec" src="images/user.gif"></a> <a href="careers.aspx" style="padding: 3px;">Careers</a></td> </tr> </tbody> </table> </div> <div class="columnleft"> <h2> Network Solutions</h2> <div style="padding: 5px;"> Get the latest communication technologies with Abtec.<br> <br> <img style="width: 80px; height: 75px;" alt="" src="images/axxess.gif"><img style="width: 50px; height: 67px;" alt="" src="images/serverintel.gif"> </div> <h2> CUSTOMER AREA</h2> <div style="padding: 5px;"> <p> <img src="images/arrowicon.gif" style="border: none;"><a href="login.aspx" style="padding: 3px;">Log in to view network stats</a></p> </div> <h2> Contact Us</h2> <div style="padding: 5px;"> Abtec Network Systems<br> The Mill, Great Bowden Road<br> Market Harborough<br> Leicestershire<br> LE16 7DE<br> <br> Tel: 0870 7874 500 <br> Email: <a href="mailto:[email protected]"><span style="font-weight: bold;">[email protected]</span></a><br> <p> <img src="images/arrowicon.gif" style="border: none;"><a href="contact.aspx" style="padding: 3px;">Contact Us</a></p> <p> <img src="images/arrowicon.gif" style="border: none;"><a href="enquiryform.aspx" style="padding: 3px;">Enquiry Form</a></p> <p> <img src="images/arrowicon.gif" style="border: none;"><a href="map.aspx" style="padding: 3px;">View map and directions</a></p> <div style="border: none;"> </div> </div> </div> <div class="columncenter"> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> <div class="columnright"> <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server"> </asp:ContentPlaceHolder> </div> <div style="width: 100%;"> </div> <div class="logo" style="float: right; margin-top: 5px; margin-right: 5px;"> <img alt="Abtec working with BT" src="images/BT_workingwith_websmall.gif"></div> <div class="footer"> © Abtec 2006 <a href="disclaimer.aspx">Disclaimer </a> </div> </div> </form> </body> </html> ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Below is an example of a content page. <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="aboutus.aspx.vb" Inherits="_Default" Title="Abtec Network Systems - About Us - Communications, LAN, WAN, telephony, firewall and network maintenance solutions for Small Medium and Enterprise Businesses."%> <asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolder3"><title>Abtec Network Systems - About Us - Communications, LAN, WAN, telephony, firewall and network maintenance solutions for Small Medium and Enterprise Businesses.</title><meta content="Communications, business telephony, pc firewall, network, maintenance, technical support, solutions, LAN, WAN, small medium business, enterprise business," name="keywords"> <meta content="Provides Communications, LAN, WAN, telephony, firewall and network maintenance Solutions for Small Medium and Enterprise Businesses. Abtec Network Systems offer network and computer technical support." name="description"></asp:content> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"><h2 id="thecompany">The Company</h2> <p>Abtec provides <span style="font-weight: bold;">The Complete Communications Solution</span>. Established in 1991, Abtec Network Systems has built up <span style="font-weight: bold;">extensive technology knowledge, expertise and experience</span> in Telephone Systems, Local and Wide Area Networks, Voice and Data Convergence, The IBM AS/400 (iSeries) and Microsoft Windows Server Solutions. <p>Abtec has delivered solutions to some of the <span style="font-weight: bold;">world’s largest multinational corporations</span>. Working alongside respected manufacturers such as BT, HP, Microsoft, Cisco, Inter-Tel, 3COM and Expand, Abtec are continuously developing partnerships and accreditations, creating a comprehensive yet flexible portfolio of solutions. From this, Abtec can immediately source everything needed to <span style="font-weight: bold;">deliver solutions to our customers</span> – for the smallest to the largest information networks. </p> <h2 id="thephilosophy">The Philosophy</h2> <p>At Abtec, we <span style="font-weight: bold;">understand the importance of staying close to our customers</span> and getting to know their business. As your needs change, so do we. That’s why Abtec solutions are <span style="font-weight: bold;">tried, tested and tailored </span>to your specific requirements by our in-house Engineers. <br> <br> Our networking expertise is complemented by our <span style="font-weight: bold;">proficiency in sales, design, installation and maintenance</span>. Therefore we not only understand what will work for you now, but also what will work for the future. We understand that running a business is a process of juggling many different aspects to succeed, technology being one of them. Abtec's experience means<span style="font-weight: bold;">:<br> <br> We can look after your business communications, whilst you concentrate on the rest</span>...<br> <br>
<p><img src="images/arrowicon.gif" style="border:none;"><a href="solutions.aspx" style="padding:3px;">View communications solutions.</a></p> <p><img src="images/arrowicon.gif" style="border:none;"><a href="portfolio.aspx" style="padding:3px;">View customer testimonials</a></p> </asp:Content> <asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder2"><div id="flashcontent"><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">If you can see this text you need to upgrade your version of flash. Please click here to visit the Macromedia site and download the latest plugin.</a><br> <br> <div style="text-align: center;"><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><img style="border: 0px solid ; width: 100px; height: 41px;" alt="Get the latest FLASH plugin" src="images/flashbutton.gif"></a> </div> <script type="text/javascript">var fo = new FlashObject("images/missionstatement.swf", "mymovie", "160", "240", "7", "#FFFFFF"); fo.addParam("loop", "true"); fo.addParam("scale", "exactfit"); fo.addParam("WMODE", "opaque"); fo.write("flashcontent"); </script></div> </asp:Content>
---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Here is the full code for your sitesearch with the modification.
using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace Search { /// <summary> /// Summary description for _Default. /// </summary> public partial class _Default : System.Web.UI.Page { protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1; protected System.Data.OleDb.OleDbDataAdapter dbAdapter; protected System.Data.OleDb.OleDbConnection dbConnection; protected void Page_Load(object sender, System.EventArgs e) { string strSearch = Request.Form["txtSearch"]; if (IsPostBack == false) { this.txtQuery.Text = strSearch; this.Search(); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dbAdapter = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.dbConnection = new System.Data.OleDb.OleDbConnection(); this.dgResultsGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.dgResultsGrid_PageIndexChanged); // // dbAdapter // this.dbAdapter.SelectCommand = this.oleDbSelectCommand1; // // oleDbSelectCommand1 // this.oleDbSelectCommand1.Connection = this.dbConnection; // // dbConnection // this.dbConnection.ConnectionString = "Provider=MSIDXS.1;Integrated Security .=\"\";Data Source=abtecwebsitesearch"; } #endregion protected void btnSearch_Click(object sender, System.EventArgs e) { this.Search(); } private void dgResultsGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) { // Update the current page index. this.dgResultsGrid.CurrentPageIndex = e.NewPageIndex; this.Search(); } /// <summary> /// Gets the command string for the search. /// <seealso cref="Search"/> /// </summary> private string Command { get { // Construct the base query. string query = String.Format(@" SELECT Rank, VPath, DocTitle, Filename, Characterization, Write FROM SCOPE('DEEP TRAVERSAL OF ""/""') WHERE NOT CONTAINS(VPath, '""_vti_"" OR "".config""')", this.cboDirectory.SelectedItem.Value); // Conditionally construct the rest of the WHERE clause. string type = this.cboQueryType.SelectedItem.Value.ToLower(); string fmt = @" AND (CONTAINS('{0}') OR CONTAINS(DocTitle, '{0}'))"; // Get the query string and remove all semi-colons, which should stop // attempt to run malicious SQL code. string text = this.txtQuery.Text.Replace(";", ""); if (type == "all" || type == "any" || type == "boolean") { string[] words = text.Split(' '); int len = words.Length; for (int i = 0; i < len; i++) { string word = words[i]; if (type == "boolean") if (String.Compare(word, "and", true) == 0 || String.Compare(word, "or", true) == 0 || String.Compare(word, "not", true) == 0 || String.Compare(word, "near", true) == 0) continue; words[i] = String.Format(@"""{0}""", word); if (i < len - 1) { if (type == "all") words[i] += " AND"; else if (type == "any") words[i] += " OR"; } } query += String.Format(fmt, String.Join(" ", words)); } else if (type == "exact") { query += String.Format(fmt, text); } else if (type == "natural") { query += String.Format(" AND FREETEXT('{0}')", text); } // Sort the results. query += String.Format(" ORDER BY {0} {1}", this.cboSortBy.SelectedItem.Value, this.cboSortOrder.SelectedItem.Value); Trace.Write("Query", query); return query; } } /// <summary> /// Perform the search. /// </summary> private void Search() { // Create a new DataSet and fill it. try { this.dbAdapter.SelectCommand.CommandText = Command; DataSet ds = new DataSet("Results"); this.dbAdapter.Fill(ds); this.lblResultCount.ForeColor = Color.Black; int rows = ds.Tables[0].Rows.Count; this.lblResultCount.Text = String.Format("{0} document{1} found{2}", rows, rows == 1 ? " was" : "s were", rows == 0 ? "." : ":"); // Bind the resulting DataSet. this.dgResultsGrid.DataSource = ds; this.dgResultsGrid.DataBind(); // If all was bound well, display the DataGrid. this.dgResultsGrid.Visible = (rows > 0); } catch (Exception ex) { this.lblResultCount.ForeColor = Color.Red; this.lblResultCount.Text = String.Format("Unable to retreive a list " + "of documents for the specified query: {0}", ex.Message); this.dgResultsGrid.Visible = false; } finally { this.lblResultCount.Visible = true; } } /// <summary> /// Get the appropriate title from the <see cref="DataGridItem.DataItem"/> /// bound to the <see cref="DataGrid"/>. /// </summary> /// <param name="value">A <see cref="DataGridItem.DataItem"/> for the current record.</param> /// <returns>Either the "DocTitle" or "Filename" respectively.</returns> protected object GetTitle(object value) { string title = DataBinder.Eval(value, "DocTitle") as string; if (title != null && title.Length > 0) return title; return DataBinder.Eval(value, "Filename"); } /// <summary> /// Encodes the characterization since some malformed text could cause /// the web browser to not render the remaining elements. /// </summary> /// <param name="value">A <see cref="DataGridItem.DataItem"/> for the current record.</param> /// <returns>The encoded characterization.</returns> protected string GetCharacterization(object value) { return Server.HtmlEncode(DataBinder.Eval(value, "Characterization") as string); } } } ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- THANKS FOR ALL THE HELP!!!!! This is a very frustrating occurence!!! and I would like to learn why it is happening! Andrew
-- modified at 11:43 Thursday 21st September, 2006
|
|
|
|
 |
:-DI have the search working, searches required directories and links. I have iis and index server set up. Problem is when I click on one of the generated links i get:
BC30456: 'btnSearch_Click' is not a member of 'ASP.masterpage_master'.
How can i rectify this?
|
|
|
|
 |
The event handler isn't defined in your master page. Are you sure you didn't implement it in a detail page accidentally? Remember, every page is a class, and event handlers must be defined in the class that you specify. If you don't specify a class class, it is assumed to be in the this instance.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Type | Article |
Licence | Ms-PL |
First Posted | 25 Jan 2003 |
Views | 482,898 |
Bookmarked | 163 times |
|
|