if(!string.IsNullOrEmpty(Session["emp_num"] as string))
{
- Jul 31 Fri 2015 11:17
C# check session is null or empty
- Jul 30 Thu 2015 17:55
C# Base64 加解密
- Jul 24 Fri 2015 18:06
c# alert
Page.RegisterClientScriptBlock("AlertMsg", "<script language=\'javascript\'>alert(\'" + msg + "\')</script>");
- Jul 24 Fri 2015 17:25
C# url encode
string
encoded = System.Web.HttpUtility.UrlEncode(input);
string
decoded = System.Web.HttpUtility.UrlDecode(encoded);
- Jul 24 Fri 2015 17:23
c# enum switch
enum Colors { None=0, Red = 1, Green = 2, Blue = 4 };
string[] colorStrings = { "0", "2", "8", "blue", "Blue", "Yellow", "Red, Green" };
Colors colorValue = (Colors) Enum.Parse(typeof(Colors), colorString);
- Jul 21 Tue 2015 11:07
JSON Bootstrap Table
http://stackoverflow.com/questions/19098797/fastest-way-to-flatten-un-flatten-nested-json-objects/19101235#19101235
- Jul 16 Thu 2015 14:04
C# .ajax Internal error 500
注意jQuery內傳的參數名稱和WebService的參數名稱要一致!
The Other Reason
- Not using JSON.stringify to pass parameter value.
- If you not supply type in jQuery, it will use GET method which is not accept in your webservice configuration. Add ( type : "POST ) in your jQuery code to use POST method.
- You are actually request data from different domain. Cross Domain Request (CORS)which is not allowed. Please read here
- Content type not supply or not correct. Use "application/json; charset=utf-8"
- DataType not not supply or not correct. Use json or jsonp
- Jul 14 Tue 2015 09:22
C# Global rewrite url
void Application_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
if(app.Request.Path.IndexOf("FriendlyPage.html") > 0)
{
app.Context.RewritePath("/UnfriendlyPage.aspx?SomeQuery=12345");
}
}
- Jul 06 Mon 2015 10:07
C# 轉址
Response.Redirect("http://www.flashwolves.com" + HttpContext.Current.Request.Url.PathAndQuery);
- Jul 02 Thu 2015 14:04
C# 修改DataSet 欄位的值
DataSet 廠商專頁ds = DBstatic.廠商專頁ds;
DataRow[] updateRow = 廠商專頁ds.Tables[0].Select("專頁編號 = '" + 專頁編號 + "'");