1、在JSP代码中:response.setHeader("Charset","GB2312");
2、在php代码中:header("Content-Type:text/html;charset=GB2312");
3、在ASP代码中:Response.Charset("GB2312")
网址编码
Uri.EscapeDataString("string")转换为网址编码
Uri.UnescapeDataString("string")
数据库连接access2003版本
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\xxx.mdb"
数据库连接access2007版本
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\data.mdb"
防盗链
From_url = Cstr(Request.ServerVariables("HTTP_REFERER"))
Serv_url = Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(From_url,8,len(Serv_url)) <> Serv_url then
response.write "非法链接!" ''防止盗链
'response.Redirect("http://www.baidu.com/")
response.end
end if
'控件属性添加
Button1.Attributes.Add("Value", "23")
函数提示
'''<summary>load事件</summary>
'''<param name="a">整数类型</param>
'''<param name="b">双精度类型</param>
Function MyFunc(ByVal a As Integer, ByVal b As Double) As Double
Return 0
End Function
'加密
Public Function EncryptString(ByVal str As String, ByVal key As String) As String
Dim bstr() As Byte = System.Text.Encoding.Default.GetBytes(str)
Dim bkey() As Byte = System.Text.Encoding.Default.GetBytes(key)
For i = 0 To bstr.Length Step 2
For j = 0 To bkey.Length Step 2
bstr(i) = System.Convert.ToByte(bstr(i) ^ bkey(j))
Next
Next
Return bstr.ToString
End Function
'解密
Public Function decryptstring(ByVal str As String, ByVal key As String)
Return EncryptString(str, key)
End Function
using System;
//特殊文件夹:我的文件夹
System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
//程序所在文件夹
System.Windows.Forms.Application.StartupPath
System.Windows.Forms.Application.CommonAppDataPath
//网络下载
var wd = new System.Net.WebClient();
wd.DownloadFile("http://www.smwing.com/nt/WebEditor/UploadFile/200912215286617.jpg", "D:\1.jpg");
//一台机器只能运行一个程序
int iRunJiYunERPCount = 0;
foreach (System.Diagnostics.Process thisproc in System.Diagnostics.Process.GetProcesses())
{
if (thisproc.ProcessName.Equals("JiYunUpdate"))
{iRunJiYunERPCount += 1;}
}
if (iRunJiYunERPCount > 1)
MessageBox.Show("为了保证用户数据安全,请勿违规使用!", gSystemConfig.gSystemName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Application.Exit();