目前分類:asp.net (50)

瀏覽方式: 標題列表 簡短摘要

大多數情況下,我都把資料庫的連接字串放在了web.config中。其中包含許多敏感資訊,包括連接資料庫的使用者名密碼等。然而我們在web.config和machine.config中以純文字的方式保存密碼安全嗎?

 

ylw1125 發表在 痞客邦 留言(0) 人氣()

ALL_HTTP=HTTP_CONNECTION:keep-alive HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 HTTP_ACCEPT_ENCODING:gzip,deflate,sdch HTTP_ACCEPT_LANGUAGE:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 HTTP_COOKIE:ASP.NET_SessionId=0usysbeqslyprqpc20htxh5z HTTP_HOST:localhost:64821 HTTP_USER_AGENT:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 
ALL_RAW=Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: ASP.NET_SessionId=0usysbeqslyprqpc20htxh5z Host: localhost:64821 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36 
APPL_MD_PATH=/LM/W3SVC/17/ROOT
APPL_PHYSICAL_PATH=C:\Users\yingling\Documents\Visual Studio 2013\Chapter14\
AUTH_TYPE=
AUTH_USER=
AUTH_PASSWORD=
LOGON_USER=
REMOTE_USER=
CERT_COOKIE=
CERT_FLAGS=
CERT_ISSUER=
CERT_KEYSIZE=
CERT_SECRETKEYSIZE=
CERT_SERIALNUMBER=
CERT_SERVER_ISSUER=
CERT_SERVER_SUBJECT=
CERT_SUBJECT=
CONTENT_LENGTH=0
CONTENT_TYPE=
GATEWAY_INTERFACE=CGI/1.1
HTTPS=off
HTTPS_KEYSIZE=
HTTPS_SECRETKEYSIZE=
HTTPS_SERVER_ISSUER=
HTTPS_SERVER_SUBJECT=
INSTANCE_ID=17
INSTANCE_META_PATH=/LM/W3SVC/17
LOCAL_ADDR=::1
PATH_INFO=/Default12.aspx
PATH_TRANSLATED=C:\Users\yingling\Documents\Visual Studio 2013\Chapter14\Default12.aspx
QUERY_STRING=
REMOTE_ADDR=::1
REMOTE_HOST=::1
REMOTE_PORT=39823
REQUEST_METHOD=GET
SCRIPT_NAME=/Default12.aspx
SERVER_NAME=localhost
SERVER_PORT=64821
SERVER_PORT_SECURE=0
SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=Microsoft-IIS/8.0
URL=/Default12.aspx
HTTP_CONNECTION=keep-alive
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING=gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE=zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
HTTP_COOKIE=ASP.NET_SessionId=0usysbeqslyprqpc20htxh5z
HTTP_HOST=localhost:64821
HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36

 

ylw1125 發表在 痞客邦 留言(0) 人氣()

foreach (Control c in Page.Form.Controls)
{

ylw1125 發表在 痞客邦 留言(0) 人氣()

jquery  

VS 2013的用戶,可以透過 NuGet加入這個套件就能解決

ylw1125 發表在 痞客邦 留言(0) 人氣()

myTextBox.Attributes.Add("onchange", "this.style.backgroundColor = 'yellow';");


ylw1125 發表在 痞客邦 留言(0) 人氣()

TextBox1.Attributes.Add("OnClick", "this.value = '';");


ylw1125 發表在 痞客邦 留言(0) 人氣()

SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["schoolConnectionString"].ConnectionString);
conn.Open();

ylw1125 發表在 痞客邦 留言(0) 人氣()

ViewState["prevUrl"] = Request.UrlReferrer.ToString();

ylw1125 發表在 痞客邦 留言(0) 人氣()

假設我們的網址為http://demo.tc/Default3.aspx?id=1019&uu=77

  1. Request.ApplicationPath
  2. //output:/
  3. Request.PhysicalPath
  4. //output:磁碟機代號:\父目錄\子目錄\Default3.aspx
  5. System.IO.Path.GetDirectoryName(Request.PhysicalPath)
  6. //output:磁碟機代號:\父目錄\子目錄
  7. Request.PhysicalApplicationPath
  8. //output:磁碟機代號:\父目錄\子目錄\
  9. System.IO.Path.GetFileName(Request.PhysicalPath)
  10. //output:Default3.aspx
  11. Request.CurrentExecutionFilePath
  12. //output:/Default3.aspx
  13. Request.FilePath
  14. //output:/Default3.aspx
  15. Request.Path
  16. //output:/Default3.aspx
  17. Request.RawUrl
  18. //output:/Default3.aspx?id=1019&uu=77
  19. Request.Url.AbsolutePath
  20. //output:/Default3.aspx
  21. Request.Url.AbsoluteUri
  22. //output:http://demo.tc/Default3.aspx?id=1019(這是上一頁的網址)
  23. Request.Url.Scheme
  24. //output:http
  25. Request.Url.Host
  26. //output:demo.tc
  27. Request.Url.Port
  28. //output:80
  29. Request.Url.Authority
  30. //output:demo.tc
  31. Request.Url.LocalPath
  32. //output:/Default3.aspx
  33. Request.PathInfo
  34. //output:
  35. Request.Url.PathAndQuery
  36. //output:/Default3.aspx?id=1019&uu=77
  37. Request.Url.Query
  38. //output:?id=1019&uu=77
  39. Request.Url.Fragment
  40. //output:
  41. Request.Url.Segments[0]
  42. //output:/
  43. Request.Url.Segments[1]
  44. //output:Default3.aspx

ylw1125 發表在 痞客邦 留言(0) 人氣()

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{

ylw1125 發表在 痞客邦 留言(0) 人氣()

using System;
using System.Collections.Generic;

ylw1125 發表在 痞客邦 留言(0) 人氣()

using System;
using System.Collections.Generic;

ylw1125 發表在 痞客邦 留言(0) 人氣()

using System;
using System.Collections.Generic;

ylw1125 發表在 痞客邦 留言(0) 人氣()

卡路里  

using System;

ylw1125 發表在 痞客邦 留言(0) 人氣()

MARS  

using System;

ylw1125 發表在 痞客邦 留言(0) 人氣()

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="listview_2.aspx.cs" Inherits="listview_2" MaintainScrollPositionOnPostback="true" %>


ylw1125 發表在 痞客邦 留言(0) 人氣()

大腸包小腸  

using System;

ylw1125 發表在 痞客邦 留言(0) 人氣()

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

ylw1125 發表在 痞客邦 留言(0) 人氣()

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

ylw1125 發表在 痞客邦 留言(0) 人氣()

using System;
using System.Collections.Generic;

ylw1125 發表在 痞客邦 留言(0) 人氣()

«12 3