Subject: ASP.NET 2.0 Instant Results Book -Survey Engine
Posted By: autolib Post Date: 8/18/2006 4:50:11 PM
Hi!

I have your ASP.NET 2.0 Instant Results book and have a question about  chapter 4 the Suvey Engine. I can get the program to work locally on my machine with Visual Web Developer Express Edition 2005. But when I place the code on my ASP.net 2.0 web site I get all kinds of errors. I do have theSql Express database converted to SQl that is not the problem. The errors  are for example:

1. In the default.aspx page references to the Master Pages can not be found.

2. The site map cannot be found.

It seems as if it wants all code to be within  the Content folder.
I did move the master pages there but I still had problems when I moved the site map code into the Content Folder.



Reply By: Imar Reply Date: 8/27/2006 4:59:22 AM
Hi autolib,

Great, you finally made it to the right forum.

But we still need a bit more information about your problem, like I described earlier.

Can you post the first 20 lines or so for the master page and the content pages? Also, can you describe the structure of your site? E.g. your folder structure and where the pages reside that you're having problems with.

This may be as simple as an incorrect MasterPageFile attribute, but it's impossible to tell without more information.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: autolib Reply Date: 8/27/2006 5:16:47 PM
I took so long because I had to get the SQL files back on my hosting site. The error below is when you navigate to the default.aspx page.

Another error I have is how do I handle the ASPNETDB file for logins? Should I take it out and put it with SQL Database? Any utility you could recommend to transfer the file? I had to create the survey SQL files form cratch on the SQL server.

Thanks

Charlie

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The virtual path '/surveyengine/MasterPage.master' maps to another application, which is not allowed.

Source Error:


Line 1:  <%@ Page Language="VB" MasterPageFile="../MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Line 2:  <%@ Register Src="../Controls/currentsurvey.ascx" TagName="currentsurvey" TagPrefix="uc1" %>
Line 3:  <asp:Content ID="main1" ContentPlaceHolderID="main" Runat="Server">
 

Source File: /surveyengine/contentfiles/default.aspx    Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Reply By: Imar Reply Date: 8/28/2006 1:04:02 AM
Hi Charlie,
quote:
Can you post the first 20 lines or so for the master page and the content pages? Also, can you describe the structure of your site? E.g. your folder structure and where the pages reside that you're having problems with.

This may be as simple as an incorrect MasterPageFile attribute, but it's impossible to tell without more information.

This is going the same route as our private e-mail conversation. It looks like you don't want help.... If you don't provide this information, how do you think we can help you?

Regarding SQL Server: it depends on the host. Quite often, they won't attach an existing .mdf file for you. Instead, you get access with the Query Analyzer or Management Studio. You can then script your existing database to SQL create scripts and execute them remotely. Alternatively, you can use DTS (SQL Server 2000) or Integration Services (SQL Server 2005) to copy structure and data between two instances.

Be aware this may be problematic if your host is using a different version of SQL Server (e.g. 2000)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: autolib Reply Date: 8/28/2006 4:40:42 PM
The code you requested is below. I assume you had the code since it was part of the book you authored. I am not trying to give you a hard time so lighten up with the comments. I just want to know why the code will not execute properly. Thanks for taking the time to take a look. I have altered nothing but the Web.config for the connection string.


--------------------------- First 20 lines of MaterPage ------
<%@ Master Language="VB" CodeFile="MasterPage.Master.vb" Inherits="MasterPage" %>
<%@ Register Src="Controls/Header.ascx" TagName="Header" TagPrefix="uc" %>
<%@ Register Src="Controls/Navigation.ascx" TagName="Navigation" TagPrefix="uc" %>
<%@ Register Src="Controls/Footer.ascx" TagName="Footer" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="HeadArea" runat="server">
</head>
<body>
  <form id="form1" runat="server">
    <div id="allpages">
      <div id="header">
        <uc:Header ID="header1" runat="server" />
      </div>
      <div id="nav">
        <uc:Navigation ID="nav1" runat="server" />
      </div>
      <div id="maincontent">
        <asp:ContentPlaceHolder ID="main" runat="server">
        </asp:ContentPlaceHolder>
      </div>
    </div>
    <div id="footer">
      <uc:Footer ID="Footer1" runat="server" />
    </div>
  </form>
</body>
</html>

------------------ First 20 lines of Default Page --------

<%@ Page Language="VB" MasterPageFile="../MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Src="../Controls/currentsurvey.ascx" TagName="currentsurvey" TagPrefix="uc1" %>
<asp:Content ID="main1" ContentPlaceHolderID="main" Runat="Server">
    <br />
    <h2>Welcome!</h2><br />
   
   
    <p>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In consequat. Cras eu
        purus. Nulla arcu metus, lacinia eget, pretium id, interdum sed, mauris. Phasellus
        tortor odio, tempus vitae, tristique quis, placerat quis, felis. Etiam at nunc sit
        amet purus pellentesque tincidunt. Ut at eros quis massa euismod consequat.
        Pellentesque ac neque vel est viverra dictum. Sed eget pede sed ipsum posuere ultrices.
    </p>
    <p>
        Sed massa. Pellentesque habitant morbi tristique senectus et netus et malesuada
        fames ac turpis egestas. Quisque vulputate, est sit amet bibendum mollis,
        pede enim hendrerit urna, quis adipiscing arcu velit eu nulla. In hac habitasse
        platea dictumst.
    </p>
   
   
        <center><uc1:currentsurvey ID="Currentsurvey1" runat="server" /></center>
      <br />
    <br />
    <br />
</asp:Content>

----------------- Webconfig ----------------------------
<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <add key="EmailFrom" value="admin@mysurveyengine.com" />
    <add key="EmailTo" value="admin@mysurveyengine.Com" />
    <add key="PageTitle" value="Wrox Survey Engine" />
    <!--
    <add key="CurrentTheme" value="CleanBlue" />
    -->
    <add key="CurrentTheme" value="CleanRed" />

  </appSettings>
  <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=SQLB1.webcontrolcenter.com;Initial Catalog=survey.mdf;Integrated Security=True;User Instance=TrueUser ID=autolib;Password=bad9rock" providerName="System.Data.SqlClient"/>

    <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" />
  </connectionStrings>
    
    <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions
            where data loss can occur.
            Set explicit="true" to force declaration of all variables.
        -->
   
        <roleManager enabled="true" />
  <compilation debug="true" strict="false" explicit="true"/>
        <pages>
            <namespaces>
                <clear/>
                <add namespace="System"/>
                <add namespace="System.Collections"/>
                <add namespace="System.Collections.Specialized"/>
                <add namespace="System.Configuration"/>
                <add namespace="System.Text"/>
                <add namespace="System.Text.RegularExpressions"/>
                <add namespace="System.Web"/>
                <add namespace="System.Web.Caching"/>
                <add namespace="System.Web.SessionState"/>
                <add namespace="System.Web.Security"/>
                <add namespace="System.Web.Profile"/>
                <add namespace="System.Web.UI"/>
                <add namespace="System.Web.UI.WebControls"/>
                <add namespace="System.Web.UI.WebControls.WebParts"/>
                <add namespace="System.Web.UI.HtmlControls"/>
            </namespaces>
        </pages>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
        <authentication mode="Forms" />
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <customErrors mode="Off">
      
    </customErrors>



  </system.web>
</configuration>



Reply By: Imar Reply Date: 8/28/2006 4:44:44 PM
You said you moved folders and files around and suggested that you didn't store the files in the content folder. So maybe you have an incorrect reference to the master page??

MasterPageFile="../MasterPage.master

This means: one level up from the current folder. If the two files are in the same folder, this breaks.

You can also try this:

MasterPageFile="~/MasterPage.master

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: autolib Reply Date: 8/28/2006 5:01:47 PM
I had tried that before and you get the following error:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The file '/SurveyEngine/ContentFiles/MasterPage.master' does not exist.

Source Error:


Line 1:  <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Line 2:  <%@ Register Src="../Controls/currentsurvey.ascx" TagName="currentsurvey" TagPrefix="uc1" %>
Line 3:  <asp:Content ID="main1" ContentPlaceHolderID="main" Runat="Server">
 

Source File: /surveyengine/contentfiles/default.aspx    Line: 1


Reply By: Imar Reply Date: 8/28/2006 5:05:26 PM
And is the error message correct? Do you have a folder called SurveyEngine that holds the master pages?

Maybe you browsed to the site like this:

http://localhost/SurveyEngine

and now, on the full domain it's something like:

http://www.SurveyEngine.com/

If that's the case you may need to change the way you reference your master pages and files.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: autolib Reply Date: 8/28/2006 5:42:31 PM

Below is what the url look like:

http://www.k12ss.com/surveyengine/contentfiles/default.aspx

Reply By: Imar Reply Date: 8/29/2006 1:05:50 AM
Sigh. I am about to give up because I get tired of it if you're not helping me help you. I asked you a ton of questions, here and before, but either you don't understand what I am asking (and don't ask follow up questions), or you don't see the relevance of my questions.

Like I said earlier, I can't look in your head. I don't know your site, your server, and what changes you made to the server or the files. I don't know if and where you uploaded your files and I don't know if you did that correctly. I don't know how you configured your server. I don't know if SurveyEngine is a simple folder or a virtual folder in IIS. I don't know where you stored your MasterPages. All these items are relevant in trying to fix the problem. In short, I can only see and understand what you tell me.

I am only asking these questions so I understand your situation, may understand your problem and help you fix it. So, here we go again, one more time:

1. And is the error message correct? Do you have a folder called SurveyEngine that holds the master pages?

2. Are the master pages actually there in that folder at the remote server?

3. Also, can you describe the structure of your site? E.g. your folder structure and where the pages reside that you're having problems with.

As you can see the structure of the site is relevant. You are referencing files, so if they are in incorrect places, things will break. So, how about you list, one by one in a hierarchical manner, all the relevant folders and files in your site?

If you're sick of my questions and posts, try this:

1. Dump all your files in one folder like SurveyEngine.

2. Make sure you also dump the Master Pages in that same folder.

3. Change the content files so they reference the master page in the same folder, like this:

MasterPageFile="MasterPage.master"

If that doesn't work, there's something wrong with your server and you need to contact your system administrator and ask how they configured your system and the SurveyEngine folder.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

Go to topic 48513

Return to index page 191
Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182