Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Issue Found: Odd Behavior in Master Page

  1. #1
    jjdunkel is offline Member
    Join Date
    Jan 2006
    Location
    Chicago
    Posts
    78

    Default Issue Found: Odd Behavior in Master Page

    I found an issue with how ASPDNSF reads the master page file.

    I added the following into the head section of the master page....
    Code:
        <script type="text/javascript">
        <!--
            function openWindow(URL, windowName, windowFeatures) {
                newWindow = window.open(URL, "windowName", windowFeatures);
                newWindow.document.write('<html><head><title>' + windowName + '</title></head><body bgcolor=ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0><img src=' + URL + '></img></body></html>');
            }
        //-->
        </script>
    And received the following error:
    Code:
    Page URL:/t-media.aspx
    Source:System.Web
    Message:You can only have one <title> element within the <head> element.
    Stack Trace:
    at System.Web.UI.HtmlControls.HtmlHead.AddedControl(Control control, Int32 index)
    at System.Web.UI.ControlCollection.Add(Control child)
    at System.Web.UI.Control.AddParsedSubObject(Object obj)
    at System.Web.UI.Control.System.Web.UI.IParserAccessor.AddParsedSubObject(Object obj)
    at ASP.app_templates_skin_1_company_master.__BuildControlHead1() in c:\client_sites\kingmotorsports\trunk\Web\App_Templates\Skin_1\company.master:line 11
    at ASP.app_templates_skin_1_company_master.__BuildControlTree(app_templates_skin_1_company_master __ctrl) in c:\client_sites\kingmotorsports\trunk\Web\App_Templates\Skin_1\company.master:line 1
    at ASP.app_templates_skin_1_company_master.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5ceed925\c87284a1\App_Web_-g4ybsy7.7.cs:line 0
    at System.Web.UI.UserControl.InitializeAsUserControlInternal()
    at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
    at System.Web.UI.Page.get_Master()
    at System.Web.UI.Page.ApplyMasterPage()
    at System.Web.UI.Page.PerformPreInit()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


    ASPDNSF seems to be judging html tags even when they are included in javascript, so to test this i added seperation in the tags(code below) and it worked fine.


    Code:
        <script type="text/javascript">
        <!--
            function openWindow(URL, windowName, windowFeatures) {
                newWindow = window.open(URL, "windowName", windowFeatures);
                newWindow.document.write('<ht' + 'ml><he' + 'ad><tit' + 'le>' + windowName + '</tit' + 'le></he' + 'ad><bo' + 'dy bgcolor=ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0><img src=' + URL + '></img></bo' + 'dy></ht' + 'ml>');
            }
        //-->
        </script>

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    We'll investigate this and post a reply about this matter shortly. Thanks for posting.

  3. #3
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    That's actually a .NET master page problem, not the software. There's a good bit of information on this online. It's trying to parse the page contents and sees the extra head and html tags in there and gets thrown off. The solution is the one you already found - break up the strings so the master page doesn't read them as new tags and the issue goes away.