There can be only one 'page' directive

P

Poppy

I opened an asp page in VS.net 2002 and then saved it as an aspx page,
"mypage.aspx".

I was prompted if I wanted to create the class file for the page and clicked
yes.

Now when I try and open the page I get the error message :

"There can be only one 'page' directive."

I am sick of these problems. I have had a look in the folder and there is
only one "mypage.aspx.vb" file.

Whats happening ?
 
K

Ken Schaefer

I haven't seen this error personally, but, in each .aspx file there can only
be one line that starts:

<%@ Page ... %>

where you set things like the page language, caching directives etc. Perhaps
open the file in Notepad and check to see if you have more than one such
line.

Cheers
Ken

: I opened an asp page in VS.net 2002 and then saved it as an aspx page,
: "mypage.aspx".
:
: I was prompted if I wanted to create the class file for the page and
clicked
: yes.
:
: Now when I try and open the page I get the error message :
:
: "There can be only one 'page' directive."
:
: I am sick of these problems. I have had a look in the folder and there is
: only one "mypage.aspx.vb" file.
:
: Whats happening ?
:
:
 
Joined
Jul 11, 2007
Messages
1
Reaction score
0
Fixing the Error

I have also received the same error. This occurs due to one of several reasons. One if which has already been noted previously as a response (can only have one line that starts as: <%@ Page ....

Another reason is simple but misleading by the error report you received. Are you doing ANY includes of an aditional ASP page?? For instance:
<!-- #Include File=NewPG.aspx -->

If you are, that page ALSO has a page declaration. Since an Include places the contents of that page at the location of the "include" directive, you now effectively have multipe Page declarations on the same asp code page...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top