$("form[name='myform'] select[name^='att']").each(function(){
alert($(this).val());
});
2008/10/13
jquery: 取出指定form內的所有select物件
在myform裡取出所有select name 開頭是'att'的值:
判斷瀏覽器是否為Google Chrome的二種方法
1. 使用jquery,但要先加入一個jquery plugin, 可以以下連結下載:
jQuery Browser Plugin
下載後,include到你的html裡,然後直接下指令即可:
2. 直接判斷navigator.userAgent裡的文字, 請參考:Detecting Google Chrome Using Javascript
jQuery Browser Plugin
下載後,include到你的html裡,然後直接下指令即可:
if ($.browser.name == "chrome")
alert("google chrome!");
2. 直接判斷navigator.userAgent裡的文字, 請參考:Detecting Google Chrome Using Javascript
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
2008/10/09
2008/10/07
2008/09/26
WCF WebService how to use Server.MapPath function. 如何在WCF WebService裡使用Server.MapPath
為何預設的WCF WebService沒有enable ASP.NET相容模式呢?
設定步驟如下:
1. 開啟aspNetCompatibilityEnabled=true

在web.config裡會看到下面這段:
2. 在Implemente的class加入AspNetCompatibilityRequirements
ITestService.cs :
TestService.cs :
這樣在client就不會有exception了....
參考資料:
因為WCF是微軟新推出的分散式架構解決方案,有些client端的應用程式並不一定是web,
所以也就沒有必要先把ASP.NET相容模式打開,保留了一些彈性。
若開啟ASP.NET相容模式後:
- WCF 行為就會在下列 ASP.NET 功能上與 ASMX 行為一致:
- 在 ASP.NET 相容性模式中執行的 HttpContext: WCF 服務可以存取 Current 與其關聯狀態。
- 檔案架構授權:在 ASP.NET 相容性模式中執行的 WCF 服務可以將檔案系統存取控制清單 (ACL) 附加至服務的 .svc 檔中,以保護自身的安全。
- 可設定的 URL 授權:在 ASP.NET 相容性模式中執行 WCF 服務時,會強制執行 WCF 要求的 ASP.NET 的 URL 授權規則。
- HttpModuleCollection 擴充性:由於在 ASP.NET 相容性模式中執行的 WCF 服務會充分參與 ASP.NET HTTP 要求的生命週期,任何透過 HTTP 管線設定的 HTTP 模組都能夠在叫用服務前/後在 WCF 要求上運作。
- ASP.NET 模擬:如果已經針對應用程式啟用了 ASP.NET 模擬,則透過 ASP.NET 模擬執行緒目前的身分識別來執行的 WCF 服務可能會與 IIS 處理序身分識別不同。 如果同時針對特定的服務作業啟用了 ASP.NET 模擬與 WCF 模擬,則服務實作最終將會透過從 WCF 取得的身分識別來執行。
- Server.MapPath無法使用是因為在WCF Server端中,HttpContext.Current會是null,所以無法使用。
設定步驟如下:
1. 開啟aspNetCompatibilityEnabled=true
在web.config裡會看到下面這段:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
2. 在Implemente的class加入AspNetCompatibilityRequirements
ITestService.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
[ServiceContract]
public interface ITestService
{
[OperationContract]
void DoWork();
[OperationContract]
string GetLogFilePath();
}
TestService.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Activation;
using System.Web;
[ServiceBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class TestService : ITestService
{
public void DoWork()
{
}
public string GetLogFilePath()
{
string logFile = "~/res/iislog/100/ex07021023.log.gz";
return HttpContext.Current.Server.MapPath(logFile);
}
}
這樣在client就不會有exception了....
參考資料:
2008/09/25
[WCF] HTTP Error 404.3 - Not Found
執行
c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg -i
即可...
請參考:
http://charlesbc.blogspot.com/2008/02/http-error-4043-not-found.html
c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg -i
即可...
請參考:
http://charlesbc.blogspot.com/2008/02/http-error-4043-not-found.html
2008/09/12
How to use HttpWebRequest object submit form data?
請參考:
p2p.wrox.com Forums - WebRequest/WebResponse form submit problem. HELP!
內容介紹如何使用HttpWebRequest送出form的資料,節錄解答的code如下:
source by Mystic
p2p.wrox.com Forums - WebRequest/WebResponse form submit problem. HELP!
內容介紹如何使用HttpWebRequest送出form的資料,節錄解答的code如下:
string url="http://www.365articles.com/modules.php?name=Your_Account";
string data="username=gogo&user_password=newnewne&op=login";
byte[] buffer=Encoding.UTF8.GetBytes(data);
string result="";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType ="application/x-www-form-urlencoded";
req.ContentLength = buffer.Length;
//req.Proxy = new WebProxy(proxy, true); // ignore for local addresses
req.CookieContainer = new CookieContainer(); // enable cookies
Stream reqst = req.GetRequestStream(); // add form data to request stream
reqst.Write(buffer, 0, buffer.Length);
reqst.Flush();
reqst.Close();
Console.WriteLine("\nPosting data to " + url);
HttpWebResponse res = (HttpWebResponse)req.GetResponse(); // send request,get response
Console.WriteLine("\nResponse stream is: \n");
Stream resst = res.GetResponseStream(); // display HTTP response
StreamReader sr = new StreamReader(resst);
result=sr.ReadToEnd();
using(System.IO.StreamWriter writer=new StreamWriter("C:\\Temp\\checkcheck.html"))
{
writer.Write(result);
}
source by Mystic
訂閱:
文章 (Atom)
-
首先你要先安裝好informix的ODBC Driver並且設定可以連結到informix db。開啟Enterprise Manager後,找到連結伺服器(SQL Server群組-->安全性),按右鍵「新增連結伺服器」: 提供者名稱:Microsoft OLE DB P...
-
簡單整理一下今天看到的這篇文章, 未來可以用指標來改善團隊狀況。 ----- 軟體工程的重要的指標 DORA 指標 (DevOps Research Assessment) 1. 部署頻率: 產品多快發佈出去 2. 投入到交貨的時間 (Lead-Time For Ch...
-
內容取自 Producthunt =============================== "What's a tool that changed your life?" - us to freelancers on Twitt...