@Html.ActionLink("關於", "About", "Home", "https", "", "", new { id = "1" ,test="000"}, new { @class="abc"})
@Url.Action("About","Home",null,"https","")
2014年5月28日 星期三
Asp.net MVC Html.ActionLink & Url.Action https(SSL)(18)
記錄一下摟
jQuery 將網頁導到https(SSL)
最近都在架構的網站都會走SSL
所以記來以後來會用到
Detect HTTP or HTTPS then force HTTPS in JavaScript
所以記來以後來會用到
$(function () {
if (window.location.protocol != "https:") {
var sslUrl = location.href.replace(/^http/i, "https");
window.location.href = sslUrl;
return;
}
});
參考網站Detect HTTP or HTTPS then force HTTPS in JavaScript
IIS 免費SSL(StartSSL)
以下兩篇保哥的文章已經算超詳細了
我也是看這兩篇就攪定摟感謝保哥
免費申請 StartSSL™ 個人數位簽章與網站 SSL 憑證完全攻略
如何在 IIS7 / IIS7.5 安裝 SSL 憑證(含 IIS7 匯入憑證的 Bug)
我也是看這兩篇就攪定摟感謝保哥
免費申請 StartSSL™ 個人數位簽章與網站 SSL 憑證完全攻略
如何在 IIS7 / IIS7.5 安裝 SSL 憑證(含 IIS7 匯入憑證的 Bug)
2014年5月12日 星期一
Javascript 呼叫c#function
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click"></asp:LinkButton>
javascript: __doPostBack('<%= LinkButton1.UniqueID %>', '');
參考網址jQuery call __doPostBack on LinkButton
2014年5月9日 星期五
c# 遮罩電話 xxx
這function效能非最佳只不過目前剛好用到
所以隨手寫了一下
如有更好的方式可提供喔謝謝!!
所以隨手寫了一下
如有更好的方式可提供喔謝謝!!
/// <summary>
/// 遮罩電話 (十個字 手機市話)(九個字 市話)(十個字以上前四後三)(四個字以下回傳空白)
/// </summary>
/// <param name="pStr">字串</param>
/// <returns>string</returns>
public static string MaskString(string pStr)
{
string mReturn = "";
if (pStr.Length == 9 && pStr.StartsWith("0")) //9碼的如高雄
{
mReturn = pStr.Substring(0,2) + "-XXX-" + pStr.Substring(5,4);
}
else if (pStr.Length == 10 && pStr.StartsWith("09"))//手機
{
mReturn = pStr.Substring(0, 4) + "-XXX-" + pStr.Substring(7, 3);
}
else if (pStr.Length == 10 && pStr.StartsWith("0"))//台北市話
{
mReturn = pStr.Substring(0, 2) + "-XXXX-" + pStr.Substring(6, 4);
}
else
{
if (pStr.Length > 10)//十個字以上
{
for (int i = 0; i < pStr.Length ; i++)
{
if ((i == 0 || i <= 3) || (i >= pStr.Length - 3)) //前四個字 後三個字出現
{
mReturn += pStr.Substring(i, 1);
}
else
{
mReturn += "X";
}
}
}
else if(pStr.Length >= 4)//四個字以上才會做
{
for (int i = 0; i < pStr.Length; i++)
{
if (i >= pStr.Length - 3) //後三個字出現
{
mReturn += pStr.Substring(i, 1);
}
else
{
mReturn += "X";
}
}
}
}
return mReturn;
}
訂閱:
意見 (Atom)