当要进行MD5加密的字符串不含中文时,那么ASP.NET的加密结果和ASP是一致的:
Response.Write(FormsAuthentication.HashPasswordForStoringInConfigFile("www.goalercn.com", "MD5"));
//结果:D66E1F138689B9B5AA4C520D9EAFFB61
Response.Write(MD5("www.goalercn.com",32))
'结果:d66e1f138689b9b5aa4c520d9eaffb61
当要进行MD5加密的字符串含中文时,两者的加密结果就不一致了:
Response.Write(FormsAuthentication.HashPasswordForStoringInConfigFile("木子屋", "MD5"));
//结果:34D9CBD5164C47058DFA3A...
阅读提要 在缺省状况下,你只能使用Visual Studio 2005的一个本机实例来管理与ASP.NET 2.0一同发行的SQL Server数据库中的安全凭证。本文将向你展示怎样用一个Web服务来包装ASP.NET 2.0提供者并通过使用一个Windows表单应用程序来管理凭证存储从而扩展这种管理能力。 如今,无论是互联网还是企业内部局域网程序一般都要求使用定制的方式来存储和管理用户帐户和角色。为此,ASP.NET 2.0提供了一个现成的提供者模型和一个SQL Sever数据库。不幸的是,只能通过Visual Studio 2005来管理该凭证数据库且只能针对本机Web应用程序。这无疑是非常不方便而且不能广泛使用的。 本文描述了一个超...
在ASP.NET MVC的一个开源项目MvcContrib中,为我们提供了几个视图引擎,例如NVelocity, Brail, NHaml, XSLT。那么如果我们想在ASP.NET MVC中实现我们自己的一个视图引擎,我们应该要怎么做呢?
我们知道呈现视图是在Controller中通过传递视图名和数据到RenderView()方法来实现的。好,我们就从这里下手。我们查看一下ASP.NET MVC的源代码,看看RenderView()这个方法是如何实现的:
protected virtual void RenderView(string viewName, string
masterName, object viewData) {
ViewContext viewContext = new ViewContext(
ControllerContext, viewName...
1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=currentTime.Day; 1.5 取当前时 int 时=currentTime.Hour; 1.6 取当前分 int 分=currentTime.Minute; 1.7 取当前秒 int 秒=currentTime.Second; 1.8 取当前毫秒 int 毫秒=c...
第一种方法:
通过URL链接地址传递
send.aspx: protected void Button1_Click(object sender, EventArgs e) { Request.Redirect("Default2.aspx?username=honge"); } receive.aspx: string username = Request.QueryString["username"];这样可以得到参数值。
第二种方法:
通过post方式。
send.aspx receive.aspxstring username = Ruquest.Form["receive"];
第三种方法...
代码如下:
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Page language="vb" %>
<script runat="server">
Dim FilePath As String = Server.MapPath("FengEr.jpg")
Sub Page_Load(Sender As Object, E As ...
<%@ page language="c#" autoeventwireup="true" debug="true" %><script language="c#" runat="server">void page_load(object sender,eventargs e){ if (!ispostback){ hashtable htb=new hashtable(); htb.add("1234","microsoft"); htb.add("3210","sum"); downlist_2.datasource=htb; downlist_2.datavaluefield="key"; downlist_2.datatextfield="value"; downlist_2.databind(); } else{ label_1.text="downlist_1 value is:"+d...
<%@ page language="vb" contenttype="text/html" responseencoding="gb2312" %><%@ import namespace="system.drawing"%><%@ import namespace="system.drawing.imaging"%><%@ import namespace="system.drawing.drawing2d"%><% response.clear() '清空缓冲区 dim height as integer=100 dim width as integer=200 dim r as new random '建立随机数对像 dim x as integer =r.next(75) '产生0-75的随机数 dim ...
<%@ page language="c#" contenttype="text/html" responseencoding="gb2312" %><script runat="server"> void page_load(object sender,eventargs e){ random objrandom=new random(); label_1.text=convert.tostring(objrandom.next(100)); } </script><asp:label id="label_1" runat="server"></asp:label>...
当我们在网站上建立数据库时,保护用户的信息安全是非常必要的。多数用户不愿意让别人知道自己的信息,同时网管也不想因为安全问题而丢失网站的信誉。无论对于谁,安全问题都是非常重要的。 为了解决这个问题,我给大家提供一个简单实用,但是老套的方法,就是口令加密。在此我们使用ASP.NET技术对口令加密。简单的讲,就是将用户提供的口令加密之后,然后让它和存放于系统中的数据比较,如果相同,则通过验证。 在ASP中,并未提供加密的对象,我们只能使用外部的对象来进行加密。现在好了,在ASP.NET中提供了加密的解决方法。在名字空间System.Web.Security中包含...
当我们在网站上建立数据库时,保护用户的信息安全是非常必要的。多数用户不愿意让别人知道自己的信息,同时网管也不想因为安全问题而丢失网站的信誉。无论对于谁,安全问题都是非常重要的。 为了解决这个问题,我给大家提供一个简单实用,但是老套的方法,就是口令加密。在此我们使用ASP.NET技术对口令加密。简单的讲,就是将用户提供的口令加密之后,然后让它和存放于系统中的数据比较,如果相同,则通过验证。 在ASP中,并未提供加密的对象,我们只能使用外部的对象来进行加密。现在好了,在ASP.NET中提供了加密的解决方法。在名字空间System.Web.Security中包含...
使用VS.NET的朋友可能经常会遇到无法调试ASP.NET的情况,有些朋友给出了一些可行的解决方案。初步总结一下,大体包括以下几个方面(请注意:这儿讨论的都是关于本地调试的解决方案): - 确定当前用户是否已经被加入到Debugger Users组 - 确定当前用户是否具有Administrator权限 - Web Application项目属性中“允许调试ASP.NET”属性是否被设为了True。也可以通过修改Web.config文件的compilation元素的debug属性为True来实现。 需要说明的是,本地调试ASP.NET应用程序需要的操作系统是Windows 2000 Professional, Windows 2000 Server...
c#代码: WebRequest mywebrq; WebResponse mywebresp; StreamReader sr; Streamwriter sw; Private void Page_Load(object sender,EventArgs e) { mywebreq=WebRequest.Create(http://localhost/Test.aspx); mywebresp=mywebreq.GetResponse(); sr=new streamReader(mywebresp.GetResponsestream()); strHtml=sr.ReadToEnd(); sw=File.CreateText(server.mappath("Test.htm")); sw.writeling(strHtml); sw.close(); Response.writeFile(Server.Mappath("Test.htm"));&nb...
public void CreateDataGrid() { DataTable flowTable=new WorkFlowBLL().GetFlowTableByCode(FunctionCode); foreach(DataRow dataRow in flowTable.Rows) { Table table=new Table(); table.CellPadding=0; table.CellSpacing=0; table.Width=Unit.Percentage(98); table.Attributes.Add("align","center"); table.Attributes.Add("style","HEIGHT:expression(document.body.offsetHeight-ToolBar.offsetHeight-SpaceBar.offsetHeight-33)"); table.CssClass="plPanelU...
using System; using System.Data; using System.Data.SqlClient; namespace SysClassLibrary { /// <summary> /// DataAccess 的摘要说明。 /// <description>数据处理基类,调用方式:DataAccess.DataSet((string)sqlstr);或者DataAccess.DataSet((string)sqlstr,ref DataSet ds); </description> /// </summary> public class DataAccess { #region 属性 protected static SqlConnection conn=new SqlConnect...
我们在进行ASP.NET开发时,经常会用到一些javascript脚本,比如: private void Button1_Click(object sender, System.EventArgs e) { Response.Write( "<script language='javascript'>alert('OK');</script>") ; } 经常是重复的书写这些脚本,如果我们能做成一个相应的函数就好了,直接就可以拿来使用。很多人都有自己的一些javascript的函数,但是大部分向这样的: /// <summary> /// 服务器端弹出alert对话框 /// </summary> /// <param name="str_Message">提示信息...