PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Beginner Question: ASP.NET w/Master Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beginner Question: ASP.NET w/Master Page

    I am following the faq guide for setting up a search page on an ASP.NET site and had a question. How exactly am I supposed to paste the code provided into the search page that I am creating? Every way that I try it, I get an error message saying "In content pages, content is not allowed outside <script> or <asp:Content> regions." As I'm sure everyone can tell, I'm very new to programming, but I would appreciate any help on this. I'm using VB, and the code before I paste looks like this:

    <%@ Page masterpagefile="master.master" language="VB" title="Search" %> <asp:Content id="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">

    <h2>Search</h2>
    <p><strong>Please use the following form to search the content of the site and locate specific information.</strong></p>
    <p></p>


    </asp:Content>


    Thanks

  • #2
    Are you pasting the code before or after the last line </asp:Content> ? I think it should be within the <asp:Content> ... </asp:Content> tags, at least that is what the error message is saying.

    I personally don't code in VB.NET so I'm not very familiar with it myself. Maybe someone else can be of help.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      I did post it between the content tags, that's why I'm confused by the whole thing.

      Thanks for the quick response.

      Comment


      • #4
        I've always found ASP.NET error messages to be some of the most confusing, inaccurate, and outright incorrect error messages around. Frankly, if you're new to programming, I would not recommend developing an ASP.NET site if you have the choice. PHP, for one, is a much more sensible platform.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Unfortunately, I do have to keep it in ASP.NET. I've looked through the other posts on the forum and haven't been able to find what I'm looking for. Are there any other resources that I could use or should I try to contact Wrensoft with the problem? Thanks.

          Comment


          • #6
            It just occurred to me to ask, is the error you are reporting coming from the web server, when you access the ASPX page? Or is this an error from your editor? (Visual Studio or ... ?)

            There's certainly very little information on this error when Googling for it, which makes me think it's the latter, or it's mis-quoted.

            This thread seems to indicate it is the latter. It also seem to say that it's pretty much an ignorable error, and things will work regardless of it.

            And the following may be of help. It is a working example from one of our users:

            Code:
            <%@ Page masterpagefile="../master.master" Language="C#" Debug="true" title="Search results" %>
            <%@ Import Namespace="System.IO" %>
            <%@ Import Namespace="System.Diagnostics" %>
            <asp:Content id="Content1" runat="server" contentplaceholderid="PageTile">
             search
            </asp:Content>
            <asp:Content id="Content2" runat="server" contentplaceholderid="PageNavigation">
             <asp:SiteMapPath runat="server" id="SiteMapPath1"></asp:SiteMapPath>
            </asp:Content>
            <asp:Content id="Content3" runat="server" contentplaceholderid="Pagecontect">
             <%
                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.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
                Encoding enc = proc.StandardOutput.CurrentEncoding;
                byte[] output = enc.GetBytes(zoom_results);
                Response.Write(Encoding.GetEncoding("UTF-8").GetString(output));
                %>
            </asp:Content>
            <asp:Content id="Content4" runat="server" contentplaceholderid="SideMenu">
             <!--#include virtual="/menus/global/side4.htm"-->            
            </asp:Content>
            Once you have it working, don't forget to use the search form from the ASP.NET support page, which would be necessary when using masterpages:
            Q. How do I create a search form on my ASPX pages?
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment

            Working...
            X