.aspx文件帮助

时间:2011-06-17 20:19:02

标签: asp.net

到目前为止,感谢大家的帮助!到目前为止,在这个网站上有一些非常有用的答案,所以希望再多一个。

我想要创建的是完全正确的,但我仍然遇到问题

http://www.webonweboff.com/widgets/ajax/ajax_linked_selection.aspx

我已经逐字复制了html和javascript,并将该文件保存为index.html(但显然是打开和关闭html和body标签)

我调用ajaxServer.aspx.cs的文件包含以下代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/javascript";
        string id = Request.QueryString.Get("id");
        string action = Request.QueryString.Get("action");
        StringBuilder returnString = new StringBuilder();

        /* 
            Retrieve the data based on values "id" and "action"
            and build a response string in this format: 
                [{text:"...",
         * 
         * value:"...",selected:false},
                 {text...}]
            No final ";" is necessary

            For example:
        returnString.Append("[{text:\"California\",value:\"CA\",selected:false}," +
                             "{text:\"OH\",value:\"Ohio\",selected:false}," + 
                             "{text:\"NY\",value:\"New York\",selected:true}]");

        */

        Response.Write(returnString.ToString());
    }
}

我调用的ajaxServer.aspx文件包含以下代码:

<%@ Page Language="C#" AutoEventWireup="true" 
    CodeFile="ajaxServer.aspx.cs" Inherits="_Default" %>

我已下载并保存的其他(.js)文件。当我运行.html文件时,我收到以下错误:

获取数据时出错!

URL:ajaxServer.asp

方法:GET

PARAMS:动作状态=,文化= EN-US

readyState的:4

状态:403

headers:Server:ASP.NET Development Server / 10.0.0.0 日期:太阳,2011年6月19日20:39:55 GMT X-AspNet-Version:4.0.30319 缓存控制:私有 内容类型:text / html;字符集= utf-8的 内容长度:2126 连接:关闭

- &GT;有人提出任何线索吗?再一次 - 提前感谢您的帮助!

3 个答案:

答案 0 :(得分:1)

将您的班级从_Default重命名为widgets_ajax_ajaxServer。

答案 1 :(得分:0)

我相信你想要更改你的ajaxServer.aspx文件,以便继承=“_ Default”而不是Inherits =“widgets_ajax_ajaxServer”。

答案 2 :(得分:0)

“(你错过了使用侦探或装配参考吗?)”完全意味着它的含义。

StringBuilder位于System.Text命名空间中。

所以你需要一个

使用System.Text;

在班级顶部的声明。

相关问题