C# 使用jQuery.load()加载用户控件

C# 使用jQuery.load()加载用户控件,c#,jquery,asp.net,user-controls,C#,Jquery,Asp.net,User Controls,我正在使用一个干净的测试页面,并使用jQuery的.load()函数加载用户控件。 我当前遇到的错误是: GEThttp://localhost:27950/OCDB/test.ascx 403(禁止) 这是我的页面代码: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <%@ Register Src="~/test.ascx" TagPrefix

我正在使用一个干净的测试页面,并使用jQuery的
.load()
函数加载
用户控件。
我当前遇到的错误是:
GEThttp://localhost:27950/OCDB/test.ascx 403(禁止)

这是我的页面代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ Register Src="~/test.ascx" TagPrefix="uc1" TagName="test" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>This is a test.</title>

     <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#ucPlaceholder').load('test.ascx');
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="ucPlaceholder">
    </div>
    </form>
</body>
</html>

这是一个测试。
$(文档).ready(函数(){
$('#ucPlaceholder').load('test.ascx');
});
和我的用户控制代码:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="test.ascx.cs" Inherits="test" %>

<input placeholder="test input"/>


正如你所看到的,它超级简单。我的直接猜测是,页面没有拾取
寄存器。有人能告诉我哪里出了问题吗?

我认为您不能使用jQuery直接调用用户控件。
但您可以借助通用http处理程序来完成此任务。



我在加载
时遇到问题。。。它的显示
无法解决符号问题。@newagrition在web配置文件中?是。但是我意识到
IHttpHandler
需要放在
.cs
文件中。现在它可以与
一起正常工作。