asp.net c# js服务器端常用
using System;
using System.Web;
namespace pub.mo
{
public class js
{
private js() { }
private static string scr_j1 = "<mce:script type=\"text/javascript\"><!--
";
private static string scr_j2 = "
// --></mce:script>";
/// <summary>
/// 输入js并停止运行
/// </summary>
/// <param name="str"></param>
public static void write_js(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write(str);
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
HttpContext.Current.Response.End();
}
/// <summary>
/// 输入js,无Response.End()
/// </summary>
/// <param name="str"></param>
public static void write_js1(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write(str);
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
}
/// <summary>
/// 弹出消息框 点确定后history.back();
/// </summary>
/// <param name="str"></param>
public static void alert(string str)
{
HttpContext.Current.Response.Write(config.j1);
HttpContext.Current.Response.Write(scr_j1);
HttpContext.Current.Response.Write("alert('" + str + "');history.back();");
HttpContext.Current.Response.Write(scr_j2);
HttpContext.Current.Response.Write(config.j2);
HttpContext.Current.Response.End();
}
/// <summary>
///
/// </sum
相关文档:
摘 要
东风汽车传动轴有限公司对外网站是典型的在线宣传平台, 其开发基于B/S模式的在线宣传的实现,采用的是ASP.NET +sql 2000模式,是凌架于互联网系统上的一个宣传平台,是地面宣传系统的一种延伸和互补。当下在中国,不同程序实现在线宣传的厂商约占78%左右,剩下的那22%左右的厂商,都在努力创造着做 ......
1.对象初始化(OnInit方法)
页面中的控件(包括页面本身)都是在它们最初的FORM中被首次初始化的。通过在ASPX页面的后台代码文件的构造器中声明你的对象,页面将知道对象的类型,并知道需要创建多少个这样的对象。一旦你在构造器中声明了你的控件,你就可以在它的任何子类,方法,事件或者属性中访 ......
新手,上网GOOGLE了半天,也没发现一个最简单的解决方案,各网站都是在抄来抄去。
刚刚配置了一台新的asp.net的网站,写一下方式,给自己做个总结。
1.安装iis 6.0,就用windows 2003 自带光盘就可以。
2.打开iis, 选择网站->新建-> 网站,然后选择目录啊,起名啊什么的,很正常的步骤。注意把脚本资源那个给选中
......
以前发过一个.NET上传文件的方法的,不过那个方法中对文件类型的判断只是对后缀名来进行判断的,这样假如我把一个txt文本文件的后缀名改为jpg了也可以上传,这样无意中就造成了安全问题。
刚刚从网上找了个方法,试验了一下,是能够辨认出正确的文件类型的,如下:
using System;
using System.Collections.Generic; ......
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["login"] != null)
&nb ......