易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.Net中用C#实现站点计数器用户控件

asax文件:
  <%@ Control Language="c#" AutoEventWireup="false" Codebehind="counter.ascx.cs" Inherits="JiAnWeb.counter" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
  <LINK href="css.css" rel="stylesheet">
  <FONT face="宋体">
  <TABLE id="table_counter" cellSpacing="0" cellPadding="0" width="750" align="center" border="0"
  runat="server">
  <TR>
  <TD style="HEIGHT: 23px" align="center" valign=middle><IMG height="1" alt="" src="pic\rightblueback.gif" width="700"></TD>
  </TR>
  <TR>
  <TD align=center valign=middle></TD>
  </TR>
  </TABLE>
  </FONT>
  -------------------
  .cs文件:
  namespace JiAnWeb
  {
  using System;
  using System.Data;
  using System.Drawing;
  using System.Web;
  using System.Web.UI.WebControls;
  using System.Web.UI.HtmlControls;
  
  /// <summary>
  /// counter 的摘要说明。
  /// </summary>
  public class counter : System.Web.UI.UserControl
  {
  protected System.Web.UI.HtmlControls.HtmlTable table_counter;
  
  private void Page_Load(object sender, System.EventArgs e)
  {
  // 在此处放置用户代码以初始化页面
  string filePath=System.Web.HttpContext.Current.Server.MapPath("hits.txt");
  System.IO.StreamReader srReadLine = new System.IO.StreamReader(
  System.IO.File.OpenRead(filePath),
  System.Text.Encoding.ASCII);//Encoding.Default是读中文
  srReadLine.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);//
  string countStr="";
  if (srReadLine.Peek() > -1)
  {
  countStr+=srReadLine.ReadLine();
  }
  int count=int.Parse(countStr)+1;
  countStr=count.ToString();
  srReadLine.Close();
  table_counter.Rows[1].Cells[0].InnerHtml="<font color=\"#009900\">";
  for (int i=0;i<countStr.Length;i++)
  {
  table_counter.Rows[1].Cells[0].InnerHtml=table_c


相关文档:

C#.Net操作XML文件的数据

XML文件作为数据数据存储介质的一种,好处在于:任何的系统均可以解析它。
XML全称:Extensible Markup Language(扩展标记语言)使用文档类型定义(DTD)或者模式(Schema)来描述数据的。可供人阅读,而且还基于一种公共的开发标准。
最近由于开发的需要,也是研究以下XML的操作,本篇日志主要总结C#.NET中是如何操作XM ......

提高Asp.Net网站性能

  &#8226;   不要使用不必要的Session,和ASP中一样,在不必要的时候不要使用Session  
  &#8226;   不使用不必要的Server Control  
  &#8226;   不使用不必要的ViewState  
  &#8226;   不要用Excepti ......

ASP.NET(C#)常用代码30例

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

c#与最牛vb算法比拼 by Error


 
文章来源: http://www.zoesan.com By Error 302777528转载请注明出处
以上vb用到指针技术查找字符串与c#一般的.indexof()查找相比较,明显看出谁快谁慢。
VB:
Option Explicit
'指针方法操作字符串
'Copy一个字符串到缓存中
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号