一些技巧和知识

来源:互联网 发布:西班牙旅游攻略 知乎 编辑:程序博客网 时间:2024/05/01 14:57

//简单产生验证码的方法

public string validateCode()   

  {       

  byte[] bytes = new byte[100];        

 Random randObj = new Random();        

 int code;       

  for (int i = 0; i < 4; i++)       

  {            

 code = randObj.Next(44, 122);           

  bytes[i] = Convert.ToByte(code);      

   }        

 ASCIIEncoding ascii = new ASCIIEncoding();        

 string validateCode = ascii.GetString(bytes,0,4);     

    return validateCode.ToString();    

 }

//退出登陆 把session和cookie消除掉1               

System.Web.Security.FormsAuthentication.SignOut();      

   HttpCookie myCookie = new HttpCookie("user_name");     

    myCookie.Expires = DateTime.Now.AddDays(-1d);      

    Response.Cookies.Add(myCookie);

//退出登陆 把session和cookie消除掉2      

   FormsAuthentication.SignOut();//消除验证信息      

   HttpContext.Current.Session.Clear();//清除Session的内容       

  HttpContext.Current.Session.Abandon();//取消当前会话

/////////提示加退到前一页  

 Response.Write("<script lanuage=javascript>alert('验证码错误');location='javascript:history.go(-1)'</script>");

/////////提示加跳转到自己指定的页面  

  Response.Write("<script language='javascript'>alert('该用户ID已经注册过'); localtion='UserRegister.aspx'</script>");

////////// ExecuteScalar()是用来执行查询,并返回查询所返回的结果集中第一行的第一列。忽略其他列或行。

  int countAdmin = Convert.ToInt32(sqlcom.ExecuteScalar()); //强制转换成数值类型,可以用来统计数字等

 

///// 自动增加列  if (e.Row.RowIndex != -1)       

  {            

 int id = e.Row.RowIndex + 1;           

   e.Row.Cells[0].Text = id.ToString();        

 }

//变色行         

 if (e.Row.RowType == DataControlRowType.DataRow)      

    {             //鼠标经过时,行背景色变             

e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'");        

     //鼠标移出时,行背景色变          

   e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");       

  }

//删除前提示       

  if (e.Row.RowType == DataControlRowType.DataRow)        

  {         

   if(e.Row.RowState==DataControlRowState.Normal||e.Row.RowState==DataControlRowState.Alternate)            {               

 ((Button)e.Row.Cells[7].Controls[1]).Attributes.Add("onclick", "javascript:return confirm('你确定要删除:/""+e.Row.Cells[2].Text+"/"吗?')");         

    }

}

Response.Write ("<p align=center class=cn>成功留言,点击<a href = list.aspx>此处</a>查看留言列表!。</p>") ; } } catch(Exception exp) { #if DEBUG Response.Write ("出现异常:" + exp.Message) ; return ; #endif//DEBUG

}

//.pdb 文件是程序数据库文件

//seo的解释 SEO的主要工作是通过了解各类搜索引擎如何抓取互联网页面、如何进行索引以及如何确定其对某一特定关键词的搜索结果排名等技术,来对网页进行相关的优化,使其提高搜索引擎排名,从而提高网站访问量,最终提升网站的销售能力或宣传能力的技术。

搜索引擎优化是这么一种技术,即是遵循搜索引擎科学而全面的理论机制,对网站结构、网页文字语言和站点间的互动外交策略等进行合理规划部署来发掘网站的最大潜力而使其在搜索引擎中具有较强的自然排名竞争优势,从而对促进企业在线销售和强化网络品牌起到作用。

简单的说,SEO是一种让网站在百度,谷歌,雅虎等搜索引擎获得较好的排名从而赢得更多潜在客户一种的网络营销方式,也是SEM(搜索引擎营销)的一种方式。      搜索引擎搜索关键字的时候,是先对XHTML标签里的<meta>标签的keyword部分的文字,然后就是标题里的文字,接着就是正文中的h1~h6标签,然后是strong标签中的文字。摘自   (http://www.blueidea.com/tech/web/2008/5870_4.asp)

原创粉丝点击