易截截图软件、单文件、免安装、纯绿色、仅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#中实现WebBrowser控件的HTML源代码读写

趁周末想折腾一下嵌入ASP.NET的WinForm程序
需要用到WebBrowser控件的HTML源码读写
就把以前的一些代码片断移值到C#下
顺便发个帖子备忘,呵呵
  
思路其实很简单,直接通过document.documentElement.outerHTML
或者使用IPersistStreamInit接口直接对流进行处理
前者我就不废话了,后者实现方法如下
&nbs ......

net中前台javascript与后台c#函数如何相互通信

C#代码与javaScript函数的相互调用
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中 ......

提高Asp.Net网站性能

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

asp.net备份数据库


Asp.Net 备份和恢复SQL SERVER 数据库
   我们通常备份数据库时,需要登录数据库服务器去备份和恢复,这样很不方便,其实SQL SERVER自带的命令可能让我们很简单地实现远程通过Asp.Net备份和恢复数据库。
BACKUP DATABASE '被备份的数据库名' TO DISK = '备份文件路径';
ALTER DATABASE '被恢复的数据库名' ......

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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号