2008年7月21日 星期一

WCF HTTPS 出現 404 not found 的問題

最近寫了一個Siverlight 的程式 ,使用 WCF 來連接 IIS Server 上的 Service,但我發現如果是連到 http 的service 則一切正常,但是如果是連到https 就會出現 HTTP 404 Not Found 的錯誤 ,經過不斷的嘗試,終於找到答案了,原來是要在Web.config加上 basicHttpBinding 的定義, 定義如下:


<bindings>

        <basicHttpBinding>

        <!-- Configure basicHttpBinding with Transport security -- >

        <!-- mode and clientCredentialType set to None.-->

           <binding name="Binding1">

               <security mode="Transport">

                   <transport clientCredentialType="None"/>

               </security>

           </binding>

        </basicHttpBinding>

    </bindings>


重點是要將 security mode 設成 Transport,這樣使用HTTPS 來連接這個service 就可以正常了,只是原來出現的 HTTP 404 Not Found 的錯誤,真是讓人怎麼想也想不到是這個問題。

2008年7月8日 星期二

FrontPage 如何 刪去列尾的空白


可以使用 Frontpage 本身的 尋找及取代的功能

1.尋找目標設定為 :b*$

2.勾選 規則運算式(X)

3.按下[全部取代(A)] 就可以了

你也可以將這個查詢規則存檔,下次再load回來,就可以重複用囉

2008年7月3日 星期四

線上轉換 c# 程式碼成HTML Code

http://www.manoli.net/csharpformat/

SilverLight 2.0 如何使用網頁上的 ActiveX control

請參考
http://pietschsoft.com/post/2008/06/Silverlight-and-JavaScript-Interop-Basics.aspx



using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Browser;

namespace DiggSample
{
public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}

private void MyButton_Click(object sender, RoutedEventArgs e)
{
MyButton.Content = "按到了!" + DateTime.Now.ToLongTimeString();
//HtmlPage.Window.Alert(HtmlPage.Document.GetElementById("XCsp").version2);
ScriptObject myScriptObject = (ScriptObject) HtmlPage.Window.Eval("XCsp;");
if (myScriptObject != null)
{
HtmlPage.Window.Alert((string)myScriptObject.GetProperty("Version2"));
double bRdrReady = (double)myScriptObject.Invoke("ConnectReader");
if (bRdrReady == 0)
{
myScriptObject.Invoke("ListReaders");
double totalReaders = (double)myScriptObject.GetProperty("inor");
if (totalReaders > 0)
{
for (int i = 0; i < totalReaders; i++)
{
ReaderList.Items.Add(myScriptObject.GetProperty("caReader"+(i+1).ToString()));
}
}
else
{
HtmlPage.Window.Alert("請安裝讀卡機");
}
}
else
{
HtmlPage.Window.Alert("bRdrReader=" + bRdrReady.ToString());
}
}

}
}
}