为什么我们不能运行ascx页面? [英] Why we can't run ascx page?

查看:69
本文介绍了为什么我们不能运行ascx页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我运行ascx页面,则显示错误,如HTTP Error 403.14 - Forbidden。



有人可以告诉我为什么我们无法运行ASCX页面。

解决方案

Ascx页面不是页面,它们不支持生成页面和执行整个asp.net页面生命周期所需的所有内容。 ascx文件旨在成为嵌入在其他页面中的控件。 IIS禁止直接访问一些它不知道用于直接查看的文件,例如cs文件,配置文件等,以及ascx文件,这就是你获取禁止消息的原因。


首先,它不是一个页面。

其次,它是一个可以嵌入页面的小型可重用组件。这些是独立的视觉元素,可以像传统的内在HTML控件一样放在网页上,并且可以以类似的方式设置它们的属性。



如果您使用Google搜索用户控件,则不会问这个问题。 :)

请参阅此文章以了解有关用户控件的更多信息,

ASP .NET中的用户控件 [ ^ ]



-KR


用户控制(* .ascx文件)并且意味着可重用性以及使复杂的aspx页面不那么复杂。用户控件是一种复合控件。用户控件没有HTML,正文或表单元素。它托管在ASP.NET页面中。



因为它没有任何HTML,正文或表单元素,这就是为什么你不能直接通过浏览器浏览它。 br />


您可以找到详细信息以及如何使用用户控制 [ ^ ]

If i run ascx page it is showing error like "HTTP Error 403.14 - Forbidden".

Can anybody please tell me why we can't run ASCX page.

解决方案

Ascx pages aren't pages they don't support everything needed to generate a page and execute the whole asp.net page lifecycle. ascx files are intended to be controls that are embedded in other pages. IIS forbids direct access to some files that it knows are not intended for direct viewing such as cs files, config file etc, as well as ascx files which is why you get the forbidden message.


First, it is not a page.
Second, it's a small reusable component that can be embedded within the page. These are self contained visual elements that can be placed on a web page in the same way as a tradition intrinsic HTML control, and can have their attributes set in a similar fashion.

If you've googled about the user controls, you wouldn't have asked this. :)
Refer this article to know more about the User Controls,
User controls in ASP .NET[^]

-KR


User Controls (*.ascx files) and are meant for reusability and also for making complex aspx-pages less complex. A user control is a kind of composite control. User Control does not have a HTML, Body or Form element. It is hosted inside an ASP.NET Page.

Since it does not having any HTML, Body or form element thats why you can not browse it via browser directly.

You can find detail what and how you can use User Control[^]


这篇关于为什么我们不能运行ascx页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆