偶尔使用,简单的记录下过程
1.下载Newtonsoft.Json.Net20.dll后,放入Asp.net项目Bin文件夹中.
Newtonsoft.Json.Net20,是一个Object/Json转换工具,这里用来把对象转换成Json格式字符串.
2.树节点Model对象,
public class TreeModel{
private string _id,_parentid, _text;
private bool _leaf;
private List<TreeModel> _children = new List<TreeModel>();//子节点集合
public string id{
get { return _id; }
set { _id = value;}
}
public string parentid{
&nbs ......
asp.net 学习资源
关于此主题仅有 1 个帖子 - 树式浏览
astin...@gmail.com
9月26日 上午12时41分 显示选项
发件人: astin...@gmail.com - 查找此作者的帖子
日期:Sun, 25 Sep 2005 09:41:54 -0700
当地时间:2005年9月26日(星期一) 上午12时41分
主题:asp.net 学习资源
答复作者 | 转发 | 打印 | 显示个别帖子 |
显示原始邮件 | 报告滥用行为
名称:快速入门
地址:http://chs.gotdotnet.com/quickstart/描述:本站点是微软.NET技术的快速入门网站,我们不必再安装.NET
Framework中的快速入门示例程序,直接在网上查看此示例即看。
名称:微软官方.NET指导站点
地址:http://www.gotdotnet.com/描述:上面的站点是本站的一个子站点,本站点提供微软.NET官方信息,并且有大量的用户源代码、控件下载,微软.NET开发组的人员也经常在此站点发表一些指导性文章。
名称:SourceForge
地址:http://www.sourceforge.net
描述:世界上最大的Open
Source项目在线网站,上面已经有.NET的各种大型Open
Source项目上千件,包括SharpDevelop、NDoc、Mono等都是在此站点发布最新源代码信息。
名称:CodeProject
......
在ASP.NET中,我们可以用下面的方法实现从数据库中读取图片并显示在页面上,方法如下:
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
String sql="SELECT image from append where id='" + strID + "'";
SqlCommand command=new SqlCommand(sql,conn);
conn.Open();
SqlDataReader dr=command.ExecuteReader();
dr.Read();
byte[] imgdata = (byte[])dr["image"];
Response.BinaryWrite(imgdata);
dr.Close();
conn.Close();
在需要显示图片的地方,加上这样的代码,来控制图片显示的位置等信息:
<asp:Image ImageUrl="showAP.aspx?id=1" ID="imgLogo" Runat="server"></asp:Image>
这样就实现了 ......
http://blog.csdn.net/chengking/archive/2005/10/27/518079.aspx
(一).选择会话状态存储方式
在Webconfig文件配置:
<sessionState mode="???" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="20"/>
Asp.net有三种方式存储会话状态信息:
1. 存储在进程中: 属性mode = InProc
特点: 具有最佳的性能,速度最快,但不能跨多台服务器存储共享.
2. 存储在状态服务器中: 属性mode = "StateServer"
特点: 当需要跨服务器维护用户会话信息时,使用此方法。
但是信息存储在状态服务器上,一旦状态服务器出现故障,信息将丢失
&nb ......
1.TextBox txt=(TextBox)PreviousPage.FindControl("TextBox1");
2.在页面注册投递页的属性
<%@ PreviousPageType VirtualPath="crouspostPage.aspx" %>
在crouspostPage.aspx的代码隐藏类中添加
public TextBox TextBox1
{
get(return _textbox);
}
在页面中Response.Write(PreviousPage.TextBox1.Text);
检测跨页投递
if(PreviousPage==null)
{
Response.Weite("sorry,This`s wrong way to invoke me");
Response.End();
return;
}
/////////如果从地址栏输入以下则会抛出异常
if(!PreviousPage.IsCrossPagePostBack)
{
......
}
///在目标页中,测试PreviousPage属性上的IsValid属性,并在答案否定的情况下中止请求
if(!PreviousPage.IsValid)
{
Response.Weite("sorry,This`s wrong way to invoke me");
Response.End();
return;
} ......
ASP.Net生成静态HTML页!
环境:Microsoft .NET Framework SDK v1.1
OS:Windows Server 2003 中文版
ASP.Net生成静态HTML页
在Asp中实现的生成静态页用到的FileSystemObject对象!
在.Net中涉及此类操作的是System.IO
以下是程序代码 注:此代码非原创!参考别人代码
//生成HTML页
public static bool WriteFile(string strText,string strContent,string strAuthor)
{
string path = HttpContext.Current.Server.MapPath("/news/");
Encoding code = Encoding.GetEncoding("gb2312");
// 读取模板文件
string temp = HttpContext.Current.Server.MapPath("/news/text.html");
StreamReader sr=null;
StreamWriter sw=null;
string str="";
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd(); // 读取文件
}
catch(Exception exp)
{
HttpContext.Current.Response.Write(exp.Mes ......