.net 代码

修改服务端代码,服务端指定客户端以某种编码来读页面。
  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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值