Solved

The directive 'page' is unknown.

Posted on 2007-04-03
12
3,371 Views
Last Modified: 2016-08-29
Following along in my book, and I was instructed to add my first user control.
I did so - it only includes an <h1> header.

Then, I followed the instructions to update an existing file (which 'was' working fine).
The 'only' changes I made, as instructed, were to add (the indented lines were already there):

    <%@ Page Language="VB" %>
<%@ Register TagPrefix="WroxUnited" TagName="SimpleHeader" Src="SimpleHeader.ascx" %>
<%@ import Namespace="System.Web.Caching" %>

And then further down into my html code,

     <form runat="server">
<WroxUnited:SimpleHeader id="HeaderControl" runat="server"></WroxUnited:SimpleHeader>

Now I'm getting the page directive is unknown?
I swear - I can take those 3 lines out and it runs fine...what happened? : \
       

0
Comment
Question by:sirbounty
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18851691
Are you using Master pages with ASP.NET 2.0?

Bob
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18851700
Not familiar with Master pages, so presumably 'not'... : )
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18851792
1) You should know if you were

2) You said that you could delete the @Page, @Register, and @Import lines, and it would work, so if you were using Master pages, that would definitely be a true statement, because the content for the pages in defined in the master, and not the page.

3) If you are not using master pages, then we need to find out the magic of how you could delete those directive lines, and it still works.

4) What is the base class for the web page?  Is it System.Web.UI.Page?

Bob
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 150 total points
ID: 18851798
Wait, you said that this was a user control, and the page directive would be rendered from the Page and not the UserControl, so you don't need those 3 lines in the UserControl.

Bob
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18852221
No, on my page (default.aspx) - I can remove the Register and IMport lines - not the Page...it works with page in there, but then if I add the other 2, it flags the Page directive as the error.
By your description, I don't believe I'm using Master Pages (yet).
I can upload the project if you'd like...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854569
I'm maxing the points here...I'd like to get this resolved so I can move along in my study.

https://filedb.experts-exchange.com/incoming/ee-stuff/3093-default.aspx.txthttps://filedb.experts-exchange.com/incoming/ee-stuff/3094-simpleheader.ascx.txt
 are the two files that I'm using...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 67

Author Comment

by:sirbounty
ID: 18854589
Even dropping this single line in yields the error - remove it and it runs...

<%@ Register TagPrefix="WroxUnited" TagName="SimpleHeader" Src="SimpleHeader.ascx" %>

Weird thing is that it points to "page" as the error, and in the 'preview' page that displayes "page" as being the error, it displays like this:


Line 1:  <%@ Page Language="VB" %>
Line 2:  <script runat="server">
Line 3:  
 

As if that line isn't in there anyway...? : \
0
 
LVL 5

Accepted Solution

by:
mzalewski earned 350 total points
ID: 18854625
My guess is that the 'Page directive' it's talking about is in the ascx file.
ASCX uses a @Control directive instead.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854635
Interestingly enough, if I remove the page directive it still works...
Then if I put it back in, farther down (into the html code), it complains about 2 directives.

The book instructed me to only insert the <h1> line in the contrl, but you're right - it's got the page directive there as well...removing it now...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854650
I split the points, cause re-reading this Bob, you were trying to tell me that before...but you both are correct - I removed everything (auto-added, I might mentioned) from the control and bingo...back in business.
Thanx!!!
0
 
LVL 12

Expert Comment

by:sandip132
ID: 18855533
sir,
please delete the pointer question also. I came here using that pointer, scratched my head for 5 minutes and scrolled to post the solution.
Bang! It is already solved! ;)
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18856512
My apologies!
Will do that post-haste! :^)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now