Web User Control

A

Angel

When i try to run the web page that contains a custom web
user control '.ascx.' file i get the following error:

The type of page you have requested is not served because
it has been explicitly forbidden. The extension '.ascx'
may be incorrect.

What is wrong?

Thanks
 
C

Chris Jackson

Ascx controls aren't meant to be served, as the message indicates, they are
meant to be consumed by aspx pages. How are you including this in your page?
 
A

Angel

I just dragged the user control onto my aspx page. I also
tried 'View in Browser' the .ascx file and got the same
error. I am wondering if its a configuration error on my
IIS. That it is a file restricted from being served.

Thanks for the quick response
 
J

Jerry Boone

I would...

Start a new project
create a webform
create a usercontrol with simple text/html
save them
drop the user control on the webform
make the webform "Set as start page"
run the project and see if you get the same error

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access
 
Joined
Mar 23, 2009
Messages
1
Reaction score
0
Make SURE you are in Design View

When you drag the user control onto the page it only works if you are in design view.
In source view the drag will produce the wrong outcome!

Hope that helps
 

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,813
Latest member
lawrwtwinkle111

Latest Threads

Top