要做一个博客,我使用了DoNetTextBox作为在线编辑器,我添加了一个提交按钮,但是运行时,点了按钮并不会转到事件处理代码,而是出现下面的错误:“/CIS”应用程序中的服务器错误。
--------------------------------------------------------------------------------无法找到资源。 
说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确。 请求的 URL: /CIS/Default_CuteEditor.aspx
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.832; ASP.NET 版本:2.0.50727.832 文件夹层次是这样的:
CIS\博客\Default_CuteEditor.aspxCIS是项目名,我以为是在线编辑器的问题,换了CuteEditor、DoNetTextBox、FckEditor、FreeTextBox 都是出现这样的问题。第一次做BS项目,请高手解难。

解决方案 »

  1.   

    把你的按钮的代码贴出来看看,DoNetTextBox这个在线编辑器没有用过
      

  2.   

    OnClick="Button1_Click" 按钮响应事件有没有?
      

  3.   

    <%@ Page  EnableViewState="false"  ViewStateEncryptionMode="never" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default_DoNetTextBox.aspx.cs" Inherits="博客_Default2" Title="Untitled Page" %><%@ Register Assembly="DotNetTextBox" Namespace="DotNetTextBox" TagPrefix="DNTB" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_ad_left" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_content" Runat="Server" EnableViewState="false">
        <dntb:webeditor id="WebEditor1" runat="server"  EnableViewState="false" ></dntb:webeditor>
        <asp:Button  runat="server" Text="提交" OnClick="button_submit_Click"  EnableViewState="false" />
        <asp:TextBox  runat="server"></asp:TextBox>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder_ad_right" Runat="Server">
    </asp:Content>
      

  4.   

    上边那个错了,button和TextBox没有ID。是这样的
    <%@ Page  EnableViewState="false"  ViewStateEncryptionMode="never" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default_DoNetTextBox.aspx.cs" Inherits="博客_Default2" Title="Untitled Page" %><%@ Register Assembly="DotNetTextBox" Namespace="DotNetTextBox" TagPrefix="DNTB" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_ad_left" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_content" Runat="Server" EnableViewState="false">
        <dntb:webeditor id="WebEditor1" runat="server"  EnableViewState="false" ></dntb:webeditor>
        <asp:Button  ID="button_submit" runat="server" Text="提交" OnClick="button_submit_Click"  EnableViewState="false" />
        <asp:TextBox  ID="textbox_1" runat="server"></asp:TextBox>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder_ad_right" Runat="Server">
    </asp:Content>
      

  5.   

    CS文件
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class 博客_Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {    }
        protected void button_submit_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/default.aspx");
        }
    }
      

  6.   

    弱弱的问句,ASPX页面在Form标签里不
      

  7.   

    把你的编辑器放在普通的aspx中试试。或许,它根本无法跟母版一起工作。
      

  8.   

    问题找到了,用了母板页后,按钮就不能正常工作了,但这是为什么,又如何处理?
    母板页代码如下:<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>延安大学校园信息网</title>
    <script language="javascript" type="text/javascript"></script>
    <link rel="Stylesheet" href="css\MasterPage.css" type="text/css" />
    <base href="http://localhost:1456/CIS/"/>
    </head>
    <body >
        <form id="form1" runat="server">
        
        <div  id="div_Container" class="Container">
            <div id ="div_header" class="header">
                <table id="table_log" class="table_log" >
                    <tr id="tr_LOG">
                    <!--网站LOG -->
                        <td id="td_log" style="width: 271px; border-style:groove; color: royalblue; font-family: 华文行楷; font-size:20pt" colspan="" rowspan="2";>
                            <strong>延安大学校园信息网</strong>
                        </td>
                    <!--导航 -->    
                        <td colspan="1" rowspan="2" style="font-size: 15pt; width: 31px; color: royalblue;
                            border-top-style: groove; font-family: 华文行楷; border-right-style: groove; border-left-style: groove;
                            border-bottom-style: groove">
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center" colspan="" rowspan="">
                            <a id="hfer_主页" href ="Default.aspx"  style="font-size:15px">主 &nbsp; &nbsp;&nbsp; &nbsp;
                                页</a>&nbsp;
                        </td>
                        <td id="td_论坛" style="width: 93px; height: 23px; vertical-align: middle; text-align: center;">
                            <a id="hfre_论坛" href ="论坛\论坛.aspx" style="font-size:15px">论 &nbsp; &nbsp; &nbsp;&nbsp;坛</a>
                        </td>
                        <td id="td_登录" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            登 &nbsp; &nbsp; &nbsp;&nbsp;录
                        </td>
                        <td id="td_注册" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            注 &nbsp; &nbsp; &nbsp; 册
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center; font-size: 15px;">
                            网站地图</td>
                    </tr>
                    <tr id="tr_Nagivator">                
                        <td id="td_博客" style="width: 99px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            <a id="href_博客" href="博客\Default_CuteEditor.aspx">博 &nbsp; &nbsp; &nbsp;&nbsp; 客</a>
                        </td>
                        <td id="td_校园市场" style="width: 93px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            校园市场
                        </td>
                        <td id="td_人才广场" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            人才广场
                        </td>
                        <td id="td_爱心招领" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            爱心招领
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center; font-size: 15px;">
                            通 &nbsp; &nbsp;&nbsp; &nbsp;知</td>
                    </tr>
                </table>
                <hr/>
            </div>
            <div  id="div_main" class="div_main">
                <div id="div_ad_left">
                    <asp:contentplaceholder id="ContentPlaceHolder_ad_left" runat="server" >
                    </asp:contentplaceholder>
                </div>
                <div id="div_content">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder_content" runat="server">
                    </asp:ContentPlaceHolder>
                </div>
                <div id="div_ad_right">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder_ad_right" runat="server">
                    </asp:ContentPlaceHolder>
                </div>        
            </div>
            <!--footer -->
            <div id="div_footer" class="footer">        
                <hr />    
                <p  id="info">延安大学校园信息网</p>    
            </div>
        </div>
        </form>
    </body>
    </html>
      

  9.   

    不管什么类型的文本编辑器都不会因为页面是否使用了母版页而致使页面某些功能无法使用。
    “/CIS”应用程序中的服务器错误。
    --------------------------------------------------------------------------------无法找到资源。
    说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确。请求的 URL: /CIS/Default_CuteEditor.aspx
    -------------------------------------------------------------------------------- 
    出现这个错误是因为母版页中加了<base href=""/>,其中的href值写错了,根据提供的文件夹结构,
    应该写成:<base href="http://localhost:1456/CIS/博客/"/>。
    因为是母版页,没有必要写<base href=""/>,建议删掉。另外,提醒下,页面级的视图(EnableViewState="false")已经禁用,有可能会引起某些不良反应。
      

  10.   

    可是我的CIS下还有论坛等其他文件夹啊,如果改成<base href="http://localhost:1456/CIS/博客/"/>其他的页面就无法正常加载了。加<base href=""/>是因为模板页顶部有个导航栏,不加<base href=""/>的话,假如进了博客页面,如果再点论坛就会出现地址解析错误的,因为进入博客页面时解析为当前页面路径对等的相对路径,机CIS\博客\Default_CuteEditor.aspx。而论坛页面在CIS\论坛\ 目录下,就会出现找不到资源的错误。而加上base标签后,每次解析地址时就会以base标签的href指向的地址为根目录。
    <!--网站LOG -->
                        <td id="td_log" style="width: 271px; border-style:groove; color: royalblue; font-family: 华文行楷; font-size:20pt" colspan="" rowspan="2";>
                            <strong>延安大学校园信息网</strong>
                        </td>
                    <!--导航 -->    
                        <td colspan="1" rowspan="2" style="font-size: 15pt; width: 31px; color: royalblue;
                            border-top-style: groove; font-family: 华文行楷; border-right-style: groove; border-left-style: groove;
                            border-bottom-style: groove">
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center" colspan="" rowspan="">
                            <a id="hfer_主页" href ="Default.aspx"  style="font-size:15px">主 &nbsp; &nbsp;&nbsp; &nbsp;
                                页</a>&nbsp;
                        </td>
                        <td id="td_论坛" style="width: 93px; height: 23px; vertical-align: middle; text-align: center;">
                            <a id="hfre_论坛" href ="论坛\论坛.aspx" style="font-size:15px">论 &nbsp; &nbsp; &nbsp;&nbsp;坛</a>
                        </td>
                        <td id="td_登录" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            登 &nbsp; &nbsp; &nbsp;&nbsp;录
                        </td>
                        <td id="td_注册" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            注 &nbsp; &nbsp; &nbsp; 册
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center; font-size: 15px;">
                            网站地图</td>
                    </tr>
                    <tr id="tr_Nagivator">                
                        <td id="td_博客" style="width: 99px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            <a id="href_博客" href="博客\Default_CuteEditor.aspx">博 &nbsp; &nbsp; &nbsp;&nbsp; 客</a>
                        </td>
                        <td id="td_校园市场" style="width: 93px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            校园市场
                        </td>
                        <td id="td_人才广场" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            人才广场
                        </td>
                        <td id="td_爱心招领" style="width: 98px; height: 23px; vertical-align: middle; text-align: center; font-size: 15px;">
                            爱心招领
                        </td>
                        <td style="vertical-align: middle; width: 99px; height: 23px; text-align: center; font-size: 15px;">
                            通 &nbsp; &nbsp;&nbsp; &nbsp;知</td>
                    </tr>
                </table>
                <hr/>
            </div>
      

  11.   

    这是MSDN上的原文:[说明] 说明:默认情况下,浏览器使用当前页面的 URL 作为解析相对路径的基准。但是,您可以在页面中包含 HTML base 元素,以指定替代基路径。
      

  12.   

    页面级的视图(EnableViewState="false")已经禁用,有可能会引起某些不良反应
    那个取消了也不行。
      

  13.   

    呵呵...现在这个问题,不是视图引起的,我只是说如果禁用了,可能会引起某些不良的反应。就算要考虑首页的导航栏,也不能在母版页里加<base href=""/>,因为这个设置并不能通用。
    一般母版页要做成通用型的。不能只考虑某一种因素。
      

  14.   

    呵呵,如果你只是一个网管被临时指派来修改一个已经成熟的网站,集成博客系统,除非你想好了完全的应对之策,否则千万不要乱动原来的代码。你可以先把你的编辑功能放入一个iframe,就像当前csdn这个页面一样,虽然它也是集成在页面上,但是它是独立的、普通的aspx,不要使用母版页。如果你开发母版页,“因为有个导航栏如何如何”就去修改通常默认的逻辑,是不合适的。另外开发时要注意所有控件中的路径相关属性都使用“~/”开始的描述,或者使用ResolveUrl方法计算出客户端使用的路径,总之不要使用相对路径。
      

  15.   

    xiaoxiaokeren说的是对的,去掉base元素后,就正常了,但是如果用href的话,
    我怎么能在任意一个目录下的页面,跳转到href指向的页面呢?“~/”似乎不管用,而且比如我现在在
    CIS\论坛\lutan.aspx页面。要访问CIS\default.aspx,href怎么写才不会出现地址解析错误?
      

  16.   

    我不是网管,网站也没成熟。我只是一个在充满荆棘的道路上行走初学者,而项目中涵盖了博客、论坛,要用母板页是肯定的,问题倒是解决了,去掉base元素,MSDN上建议用服务器端控件,用HyperLink就不会出现这样
    的错误。不过还是很想知道用A href怎么实现任意目录间的页面跳转并且不会出现地址解析错误。
    问题已经解决,在此感谢所有参与到本次讨论中的同志,特别感谢xiaoxiaokerensp1234,不知两位高人能留下QQ吗,我的463127310,该结贴散分了。
      

  17.   

            private void button6_Click(object sender, EventArgs e)
            {
                FolderBrowserDialog folderDialog = new FolderBrowserDialog();
                
                folderDialog.Description = "选择文件夹";            if (folderDialog.ShowDialog() == DialogResult.OK)
                {
                    btnOpen.Enabled = true;
                    label6.Text = folderDialog.SelectedPath;
                }
            }
            private void Form1_Load(object sender, EventArgs e)
            {
                //btnOpen.Enabled = false;
                //button2.Enabled = false;
                
               
            }
      

  18.   

            private void button6_Click(object sender, EventArgs e)
            {
                FolderBrowserDialog folderDialog = new FolderBrowserDialog();
                
                folderDialog.Description = "选择文件夹";            if (folderDialog.ShowDialog() == DialogResult.OK)
                {
                    btnOpen.Enabled = true;
                    label6.Text = folderDialog.SelectedPath;
                }
            }
            private void Form1_Load(object sender, EventArgs e)
            {
                //btnOpen.Enabled = false;
                //button2.Enabled = false;
                
               
            }