摘要:using System;using System.Data;using System.Configuration;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;/// <summary>/// CetFileUpload 的摘要说明/// </summary>public clas
阅读全文
摘要:1、保留小数点后两位Double dValue = 95.12345;int iValue = 10000;string strValue = "95.12345";string result = "";result = Convert.ToDouble(dValue).ToString("0.00");//保留小数点后两位,结果为95.12result = Convert.ToDouble(iValue).ToString("0.00");//10000.00 result = Convert.ToDouble(
阅读全文
摘要:System.Net.WebClient wc = new System.Net.WebClient();string saveurl = "E:\\ly\\学习\\" + FileName;wc.DownloadFile(hp, saveurl);
阅读全文
摘要:要解决的问题:将下面的URL作为一个参数传到其他的页面1 http://domain/de.apx?uid=12&page=152 url后面的参数中出现汉字等,如: ....aspx?title=起重机在出现上面的情况的时候,必须经过一个URL编码和解码的过程,否则会出现错误.Server.UrlEncode()则以默认的编码对URL进行编码和解码 string temp = " <a href='Add.aspx?url=" +Server.UrlEncode( skin.Page.Request.Url.AbsoluteUri )+ "
阅读全文
摘要:<%Response.Cookies("domain") = "163.com"Response.Cookies("webmaster")("name") = "163"Response.Cookies("webmaster")("email") = "mail.163.com"'输出全部CookieDim X,YFor Each X In Request.Cookies '判断是否带有键(Keys) If Req
阅读全文
摘要:<input type="button" id="but2" runat="server" value="下一步" onclick="notice()"/> <script language="javascript" type="text/javascript"> function notice() { document.write("<%caozuo();%>"); } </script>
阅读全文
摘要:C#获取指定网页HTML原代码可使用WebClientWebRequestHttpWebRequest 三种方式来实现。WebClientprivate string GetWebClient(string url){ string strHTML = ""; WebClient myWebClient = new WebClient(); Stream myStream = myWebClient.OpenRead(url);//为从具有指定 URI 的资源下载的数据打开一个可读的流。 StreamReader sr = new StreamReader(myStre..
阅读全文
摘要:1、查找当前exe应用程序是否在进程管理器public static Boolean SearchProcess(string str) { int i = 0; bool result = true; //获得进程对象,以用来操作 System.Diagnostics.Process myproc = new System.Diagnostics.Process(); //得到所有打开的进程 try { ...
阅读全文
摘要:第一种:for方法,可以获取到排序及值 if (getid != "") { string[] array = getfile.Split('|'); for (int mi = 0; mi < array.Length; mi++) { string m = array[mi].ToString(); ...
阅读全文
摘要:1、前台 <asp:FileUpload ID="FileUpload1" runat="server" Width="305px" /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="导入SQL" /></td>2、后台引入空间:using System.Data.Sql;using System.Data.SqlClient;
阅读全文
摘要:在工作过程中,发现js调用c#程序的时候,会出现一些无法获取js变量的情况,由于page_load先于javascript执行,故有可能导致此错误,而将js变量,如"+str+" 中的+str+作为string类型,直接传递给c#后台中以下为验证过的可行性的cs获取js变量值的方法:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DO
阅读全文
摘要:#region - 手机归属地 - private static string GetMobileInfo(string number) { string str = ""; try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(" http://vip.showji.com/locating/?m==" + number); // xmlDoc...
阅读全文
摘要:Server.MapPath获得的路径都是服务器上的物理路径,也就是常说的绝对路径1、Server.MapPath("/")注:获得应用程序根目录所在的位置,如 C:\Inetpub\wwwroot\。2、Server.MapPath("./")注:获得所在页面的当前目录,等价于Server.MapPath("")。3、Server.MapPath("../")注:获得所在页面的上级目录。4、Server.MapPath("~/")注:获得当前应用级程序的目录,如果是根目录,就是根目录,如果是虚
阅读全文
摘要:public void CreateExcel(DataSet ds, string FileName) { HttpResponse resp; resp = Page.Response; resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); resp.AppendHeader("Content-Disposition", "attachment;filename=" + FileName); string colHeaders = "&quo
阅读全文
摘要:<form id="form1" runat="server"> <div align="left"> <fieldset style="width: 350px; height: 150px"> <p> 选择颜色</p> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td></td>
阅读全文
摘要:<div id="div1" style="width:300px;height:300px; background:pink;"></div><input type="button" value="改变大小" onclick="change();" /><script type="text/javascript">function change(){ var div1=document.getElementById("
阅读全文
摘要:#region - 下载文件- /// <summary> /// 下载文件 /// </summary> /// <param name="URL">下载文件地址</param> /// /// <param name="Filename">下载后的存放地址</param> /// <param name="Prog">用于显示的进度条</param> /// publi...
阅读全文
摘要:string str = "10|20|30|40|50|60|70|80"; string[] array = str.Split('|'); DataSet ds = new DataSet(); DataTable dt = new DataTable(); //声明int类型的列id DataColumn dc = new DataColumn("id", typeof(int)); //为Datatable增加一列 d...
阅读全文
摘要:public static string filesdirectorypath = @"D:\文件夹1"; public static int dirnamelength = 0; protected void Page_Load(object sender, EventArgs e) { ZipFileCreate(); }#region - ZipFileCreate(); - /// <summary> /// 压缩文件的方法 /// </summary> public void ZipFileCr...
阅读全文