2014年10月7日 星期二
Oracle Client 32bit & 64bit 共存[當與具有 32 位元的 Oracle 用戶端元件執行 64 位元模式安裝時,會出現此問題]
Vistual Studio 引發錯誤
Error Message: 嘗試載入 Oracle 用戶端程式庫時傳出 BadImageFormatException。當與具有 32 位元的 Oracle 用戶端元件執行 64 位元模式安裝時,會出現此問題
Windows Path:加入oracle client 32bit的路徑
Error Message: 嘗試載入 Oracle 用戶端程式庫時傳出 BadImageFormatException。當與具有 32 位元的 Oracle 用戶端元件執行 64 位元模式安裝時,會出現此問題
Windows Path:加入oracle client 32bit的路徑
2014年2月23日 星期日
2013年5月13日 星期一
Flex call WebService
Flex 佈署時, 發生跨網域呼叫的安全性問題, 解決方式二
一、建立跨網域配置文件
內容如下:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
檔名存成:crossdomain.xml
請放在Inetpub\wwwroot內
二、程式內透過Security.loadPolicyFile(http://xxx/crossdomain.xml);
2013年3月28日 星期四
動態加入CSS & Javascript
Master page:
css
<link href="~/Plugins/Css/Style.css" rel="stylesheet" type="text/css" /> //可直接加~/
Javascript
<script type="text/javascript" src='<%#ResolveUrl("~/Plugins/Js/JScript.js") %>'></script> //使用ResolveUrl即可
Master page cs:
//不重新bind會有javascript error
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
Page.Header.DataBind();
}
2012年11月5日 星期一
OAuth 2.0
1) Register your application into Google to have client ID & secrete key
2) Login here : https://code.google.com/apis/console/
3) App Access : Create ID
5) xxx.cs
public string Email_address = "";
public string Google_ID = "";
public string firstName = "";
public string LastName = "";
public string Client_ID = "";
public string Return_url = "";
public string Picture = "";
protected void Page_Load(object sender, EventArgs e) {
if (!this.IsPostBack) {
Client_ID = ConfigurationSettings.AppSettings["google_clientId"].ToString();
Return_url = ConfigurationSettings.AppSettings["google_RedirectUrl"].ToString();
}
if (Request.QueryString["access_token"] != null) {
String URI = "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + Request.QueryString["access_token"].ToString();
WebClient webClient = new WebClient();
Stream stream = webClient.OpenRead(URI);
string b;
using (StreamReader br = new StreamReader(stream)) {
b = br.ReadToEnd();
}
b = b.Replace("id", "").Replace("email", "");
b = b.Replace("given_name", "");
b = b.Replace("family_name", "").Replace("link", "").Replace("picture", "");
b = b.Replace("gender", "").Replace("locale", "").Replace(":", "");
b = b.Replace("\"", "").Replace("name", "").Replace("{", "").Replace("}", "");
Array ar = b.Split(",".ToCharArray());
for (int p = 0; p < ar.Length; p++) {
ar.SetValue(ar.GetValue(p).ToString().Trim(), p);
}
Google_ID = ar.GetValue(0).ToString();
Email_address = ar.GetValue(1).ToString();
firstName = ar.GetValue(4).ToString();
LastName = ar.GetValue(5).ToString();
Picture = ar.GetValue(7).ToString();
}
}
ref 1:https://developers.google.com/accounts/docs/OAuth2#basicsteps
2) Login here : https://code.google.com/apis/console/
3) App Access : Create ID
4) Web.Config add :
public string Email_address = "";
public string Google_ID = "";
public string firstName = "";
public string LastName = "";
public string Client_ID = "";
public string Return_url = "";
public string Picture = "";
protected void Page_Load(object sender, EventArgs e) {
if (!this.IsPostBack) {
Client_ID = ConfigurationSettings.AppSettings["google_clientId"].ToString();
Return_url = ConfigurationSettings.AppSettings["google_RedirectUrl"].ToString();
}
if (Request.QueryString["access_token"] != null) {
String URI = "https://www.googleapis.com/oauth2/v1/userinfo?access_token=" + Request.QueryString["access_token"].ToString();
WebClient webClient = new WebClient();
Stream stream = webClient.OpenRead(URI);
string b;
using (StreamReader br = new StreamReader(stream)) {
b = br.ReadToEnd();
}
b = b.Replace("id", "").Replace("email", "");
b = b.Replace("given_name", "");
b = b.Replace("family_name", "").Replace("link", "").Replace("picture", "");
b = b.Replace("gender", "").Replace("locale", "").Replace(":", "");
b = b.Replace("\"", "").Replace("name", "").Replace("{", "").Replace("}", "");
Array ar = b.Split(",".ToCharArray());
for (int p = 0; p < ar.Length; p++) {
ar.SetValue(ar.GetValue(p).ToString().Trim(), p);
}
Google_ID = ar.GetValue(0).ToString();
Email_address = ar.GetValue(1).ToString();
firstName = ar.GetValue(4).ToString();
LastName = ar.GetValue(5).ToString();
Picture = ar.GetValue(7).ToString();
}
}
ref 1:https://developers.google.com/accounts/docs/OAuth2#basicsteps
2012年10月19日 星期五
Eval & Bind
GridView中取得資料值寫法
Eval:資料唯讀顯示
<%# Eval("欄位名稱") %> => 調用DataBinder.Eval
.NET 1.0 舊寫法 DataBinder.Eval(Container.DataItem,"欄位名稱")
建議使用新的寫法
DataItem:
<%#((DataRowView)Container.DataItem)["欄位名稱"] %> 效能最佳
Bind:資料為雙向互動, 具有Insert, Update, Delete功能
<%# Bind("欄位名稱") %>
Eval:資料唯讀顯示
<%# Eval("欄位名稱") %> => 調用DataBinder.Eval
.NET 1.0 舊寫法 DataBinder.Eval(Container.DataItem,"欄位名稱")
建議使用新的寫法
DataItem:
<%#((DataRowView)Container.DataItem)["欄位名稱"] %> 效能最佳
Bind:資料為雙向互動, 具有Insert, Update, Delete功能
<%# Bind("欄位名稱") %>
訂閱:
文章 (Atom)
