可怕的异常

asflhalwihfilaa 2006-03-30 02:30:21
未处理的“System.StackOverflowException”类型的异常出现在 mscorlib.dll 中。

错误代码如下:_header = (friendsheader)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar+"contorls/friendsheader.ascx");

override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//

_header = (friendsheader)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar+"contorls/friendsheader.ascx");
_subheader = new SubHeader();
Page.Controls.AddAt(0,_header);
Page.Controls.AddAt(0,_subheader);
InitializeComponent();
base.OnInit(e);
}
...全文
153 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
asflh66hfilaa 2006-03-30
  • 打赏
  • 举报
回复
up
panzi667 2006-03-30
  • 打赏
  • 举报
回复
看的眼花
asflhalwihfilaa 2006-03-30
  • 打赏
  • 举报
回复
复制进去帮我看看啊~谢谢!!!
humin1906 2006-03-30
  • 打赏
  • 举报
回复
晕,这么多的代码一起上了,
单步调式看哪里错了。
asflhalwihfilaa 2006-03-30
  • 打赏
  • 举报
回复
namespace friendsreunion.contorls
{
using System;
using System.Data;
using System.ComponentModel;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.IO;
using friendsreunion.contorls;
using System.Web.UI;
/// <summary>
/// friendsheader 的摘要说明。
/// </summary>
public class friendsheader : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Panel pnlHeaderGlobal;

protected friendsreunion.SubHeader SubHeader1;
protected System.Web.UI.WebControls.Image Image2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label lblWelcom;
protected System.Web.UI.WebControls.Image imgIcon;
protected System.Web.UI.WebControls.Label lblCounter1;
protected System.Web.UI.WebControls.Image imgShow;
protected System.Web.UI.WebControls.DropDownList cbBackColor;
protected System.Web.UI.WebControls.Label lblCounter;
protected System.Web.UI.WebControls.Panel Panel2;


private void Page_Load(object sender, System.EventArgs e)
{
this.lblCounter.Text = Application["counter"].ToString();
imgShow.Attributes.Add("onclick","document.getElementByld('tbPrefs').style.display='block';");
imgShow.Style.Add("cursor","pointer");
if(!Page.IsPostBack)
{
cbBackColor.Items.Clear();
cbBackColor.Items.Add(string.Empty);
System.Drawing.ColorConverter cv = new ColorConverter();
Color selected = Color.Empty;
if(Request.Cookies["backcolor"]!=null&&Request.Cookies["backcolor"].Value!=null&&Request.Cookies["backcolor"].Value!=string.Empty)
{
selected = (Color)cv.ConvertFromString(Request.Cookies["backcolor"].Value);
}
TypeConverter.StandardValuesCollection col = cv.GetStandardValues(null);
ListItem li;
foreach(Color c in col)
{
li = new ListItem(c.Name,ColorTranslator.ToHtml(c));
if(c.Equals(selected)) li.Selected = true;
cbBackColor.Items.Add(li);
}
}
// 在此处放置用户代码以初始化页面
}

private string _message = string.Empty;
private string _imageurl = string.Empty;
friendsheader _header;
SubHeader _subheader;
public string Message
{
get{return _message;}
set{_message = value;}
}
public string IconImageUrl
{
get{return _imageurl;}
set{_imageurl = value;}
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
Page.Controls.Remove(_header);
Page.Controls.Remove(_subheader);
HtmlForm form =(HtmlForm)Page.Controls[1];
form.Controls.AddAt(0,_header);
form.Controls.AddAt(1,_subheader);
_header.Message = _message;
_header.IconImageUrl = _imageurl;
string bg = Response.Cookies["backcolor"].Value;
if(bg == null && Request.Cookies["backcolor"]!=null&&Request.Cookies["backcolor"].Value!=null&&Request.Cookies["backcolor"].Value!=string.Empty)
{
bg=Request.Cookies["backcolor"].Value;
Request.Cookies.Add(Request.Cookies["backcolor"]);
}
if(bg !=null&&bg !=string.Empty)
{
HtmlGenericControl div = new HtmlGenericControl("div");
div.Style.Add("background-color",bg);
Page.Controls.Remove(form);
Page.Controls.AddAt(1,div);
div.Controls.Add(form);
}

base.Render(writer);
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//

_header = (friendsheader)LoadControl(Request.ApplicationPath + Path.AltDirectorySeparatorChar+"contorls/friendsheader.ascx");
_subheader = new SubHeader();
Page.Controls.AddAt(0,_header);
Page.Controls.AddAt(0,_subheader);
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.cbBackColor.SelectedIndexChanged += new System.EventHandler(this.cbBackColor_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void cbBackColor_SelectedIndexChanged(object sender, System.EventArgs e)
{
Response.Cookies.Add(new HttpCookie("backcolor",((DropDownList)sender).SelectedItem.Value));
}
}
}




下面的是SubHeader.cs代码:
using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace friendsreunion
{
/// <summary>
/// SubHeader 的摘要说明。
/// </summary>
public class SubHeader:WebControl
{
//the url to navigate to if the user is not registered
private string _register = string.Empty;
public SubHeader()
{
//
// TODO: 在此处添加构造函数逻辑
//
this.Width =new Unit(100,UnitType.Percentage);
this.CssClass="SubHeader";
}
//Property to allow the user to define the url for the
//registration page
public string registerurl
{
get
{
return _register;
}
set
{
_register=value;
}
}
//this method is called when the control is being built
protected override void CreateChildControls()
{
//clear any previously load controls
this.Controls.Clear();
Label lbl;
HyperLink reg= new HyperLink();
reg.Text="Register";
if(Context.User.Identity.IsAuthenticated)
{
reg.Text = "修改我的个人资料";
reg.NavigateUrl = Context.Request.ApplicationPath
+Path.AltDirectorySeparatorChar
+Path.AltDirectorySeparatorChar+"NewUser.aspx";
}
else
{
reg.Text = "Register";
reg.NavigateUrl=_register;
}

this.Controls.AddAt(0,reg);

this.Controls.Add(new LiteralControl(" - "));

if(Context.User.Identity.IsAuthenticated)
{
lbl=new Label();
lbl.Text=Context.User.Identity.Name;
this.Controls.Add(lbl);
}
lbl = new Label();
lbl.Text = DateTime.Now.ToLongDateString();
this.Controls.Add(lbl);
}
}
}




帮我看看哪里出错了啊~我找不到
qhh389 2006-03-30
  • 打赏
  • 举报
回复
up
吐司vivi 2006-03-30
  • 打赏
  • 举报
回复
是否有什么数组越界之类的代码 查查看
time_is_life 2006-03-30
  • 打赏
  • 举报
回复
StackOverflowException 因执行堆栈溢出错误引发,通常在存在非常深的递归或无界递归时发生。

检查一下是否存在非常深的递归或无界递归
源码链接: https://pan.quark.cn/s/8ddf8a1c92f9 **libcurl用于获取大型文件**libcurl作为一个开源的C语言库,提供了一系列的API来处理与URL相关的任务,涵盖了HTTP、FTP、SMTP等多种网络协议的应用。在执行大型文件的下载操作时,libcurl展现出卓越的性能表现和高度的灵活性,能够高效地管理大文件传输过程,有效预防内存溢出及其他潜在问题。**libcurl的基础操作**libcurl的基础应用包括以下几个环节:1. **初始化**:需要借助`curl_global_init()`函数来启动libcurl的工作环境。2. **建立会话句柄**:通过`curl_easy_init()`函数创建一个会话句柄,该句柄将用于后续所有的操作流程。3. **配置选项**:运用`curl_easy_setopt()`函数来设定多种参数,例如目标URL、超时时间、重试次数以及数据写入的回调函数等。4. **执行请求**:调用`curl_easy_perform()`函数来实施下载操作。5. **释放资源**:使用`curl_easy_cleanup()`函数来释放已经占用的资源。**获取大型文件时的重要设置**1. **数据写入回调函数**:在处理大型文件下载时,通常不希望一次性将整个文件载入内存。可以配置`CURLOPT_WRITEFUNCTION`选项,指定一个回调函数来处理接收到的数据片段,这样libcurl在接收到数据时会调用该函数,使得我们可以按需将数据写入文件或缓冲区。2. **缓冲策略**:可以设定缓冲区的大小(比如,通过`CURLOPT_BUFFERSIZE`),来控制每次接收数据的数量,从而优化内存...
内容概要:本文档整合了《鬼谷子·决篇》与《三略·审权变第三》《差德行第四》三大古代智慧典籍,构建了一套“决策+形势+用人”三位一体的领导力提升体系。通过28天三合实战路径、三维诊断工具、9个实用模板及独特的“身体锚点”仪式,系统解决管理者在决策犹豫、形势误判、人岗错配等方面的痛点。全文涵盖理论溯源、方法论拆解(如三步决策法、审权变四步法、差德行四步法)、历史案例对照(范蠡 vs 项羽)以及跨资源联动建议,形成从认知到实践的完整闭环。; 适合人群:中基层管理者、创业者、职场进阶者,尤其是面临决策困境、环境适应困难或团队用人问题的人群;具备一定管理经验或自我提升意识的个体亦可受益。; 使用场景及目标:① 提升重大事项的决策质量,避免反复纠结与事后后悔;② 增强对外部环境变化的敏感度与应对能力,实现灵活调整;③ 科学评估人才德才素质,实现人岗精准匹配,减少用人失误;④ 构建个人化的决策-应变-用人标准化流程(SOP)。; 阅读建议:建议按照28天路径逐步实践,结合自测表定位短板,优先突破薄弱模块;配套工具模板需实际填写使用,配合身体锚点仪式强化行为记忆;可与“诸葛亮决策术”“立将威信术”等单品联动,全面提升领导力体系。

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧