程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Model.Jxs_

qq_22055087 2014-12-19 10:09:51
用了母版页,走完母版页就报错了。
页面代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dbhelp;
using Model;
using DAL;
namespace DealersAdmin
{
public partial class Contact : System.Web.UI.Page
{

/// <summary>
/// 个人信息采用viewstate
/// </summary>
private Jxs_Admin jxs_admin {

get {

object o = ViewState["jxs_admin"];
return o == null ? null : (Jxs_Admin)o;

}
set {

ViewState["jxs_admin"] = value;

}


}
Jxs_AadminDAL jsx_admindal = new Jxs_AadminDAL();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

if (Session["Userid"] == null)
{

Help.Msg("请先登录在使用本功能!", "Login.aspx");
return;

}
else
{
jxs_admin = new Jxs_Admin();//这里我不实例化下面可以用吗,
jxs_admin = jsx_admindal.GetModel(Session["Userid"].ToString());
Companyname.Value = jxs_admin.Companyname;
HeadName.Value = jxs_admin.Headname;
Fax.Value = jxs_admin.Fas;
cellphone.Value = jxs_admin.Cellphone;
mailbox.Value = jxs_admin.Mailbox;
companyaddress.Value = jxs_admin.Companyaddress;
Consignee.Value = jxs_admin.Consignee;
Consigneephone.Value = jxs_admin.Consigneephone;
Consigneeaddress.Value = jxs_admin.Consigneeaddress;
beizhu.Value = jxs_admin.Beizhu;


}
}
else {


if (!string.IsNullOrEmpty(Request.QueryString["Action"]))
{

string Action = Request.QueryString["Action"].ToString();
if (Action.Equals("Update"))
{

jxs_admin.Address = jxs_admin.Address;


}

}

}
}
}
}

以上代码没报错。。是走完母版页的page_load之后报错的
母版页代码

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

namespace DealersAdmin
{
public partial class Coon : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void console_Click(object sender, EventArgs e)
{
Session.Remove("userid");
Dbhelp.Help.Msg("退出成功!","Login.aspx");
}
}
}



走完了母版页就报错了

报错信息
“/”应用程序中的服务器错误。
程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Model.Jxs_Admin”未标记为可序列化。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.Runtime.Serialization.SerializationException: 程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Model.Jxs_Admin”未标记为可序列化。

源错误:

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪:


[SerializationException: 程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Model.Jxs_Admin”未标记为可序列化。]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +10494323
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +230
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +121
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +178
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +51
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +540
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +12
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +2509

[ArgumentException: 序列化类型“Model.Jxs_Admin”的值“Model.Jxs_Admin”时出错。]
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3380
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +118
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph, Purpose purpose) +71
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Serialize(Object state, Purpose purpose) +8
System.Web.UI.Util.SerializeWithAssert(IStateFormatter2 formatter, Object stateGraph, Purpose purpose) +40
System.Web.UI.HiddenFieldPageStatePersister.Save() +106
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +108
System.Web.UI.Page.SaveAllState() +659
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1225

...全文
552 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
[SerializationException: 程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Model.Jxs_Admin”未标记为可序列化。]
qq_22055087 2014-12-19
  • 打赏
  • 举报
回复
加了序列化就不抱错了。。为什么会报这个错呢

62,046

社区成员

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

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

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

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