UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-#Author#
[所有文章分類]
所有文章分類
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • Newtonsoft.Json.JsonConvert.DeserializeObject 失敗的情況
    test...more
  • dotnet ef dbcontext scaffold
    ...more
  • [ASP.NET] 利用 aspnet_regiis 加密 web.config
    ...more
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • [錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
    ...more
  • 用 Javascript 跨網頁讀取 cookie (Cookie cross page, path of cookie)
    ...more
  • 線上客服 - MSN
    本人信箱被盜用以致資料外洩,是否可以請貴平台予以協助刪除該信箱之使用謝謝囉...more
  • 插入文字到游標或選取處
    aaaaa...more
  • IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
    太感謝你了~~~你救了我被windows 認證卡了好幾天QQ...more
  • PostgreSQL 的 monitor trigger
    FOR EACH ROW 可能要改為 FOR EACH STATEMENT ...more
標籤
  • 12
  • -5959 UNIO
  • visual stu
  • AD
  • @@Yk5Fc
  • 碧潭
  • asp
  • dbcontext
  • Mirror
  • WU
  • Line212112
  • 欄位
  • @@5vcdf
  • 232
  • bugzilla
  • -3849
  • MD5
  • 20
  • encript
  • MSkvKiovQU
  • web.config
  • 找到的組件資訊清單定
  • CS
  • url
  • 66
  • Deadlock
  • sql cache
  • replace
  • HTTP Error
  • load
  • GN
  • sql
  • GUI
  • CKEditor
  • expr 91048
  • [t]
  • MS8qKi9hTm
  • Cookie
  • 22
  • freetextbo
  • 100
  • -9825 ORDE
  • c
  • 60.5CtEp
  • Chrome2121
  • EN ORDER B
  • 備份21211211
  • 8CRLF-Head
  • 6903
  • sp_
頁數 1 / 4 下一頁
搜尋 vb 結果:
使用FtpWebRequest.ReName實現移動檔案功能
FtpWebRequest類別沒有提供移動檔案的命令,但是可以透過WebRequestMethods.Ftp.Rename達成相同效果的功能。

    FtpWebRequest ftp_Request = null/* TODO Change to default(_) if this is not a reference type */;
    FtpWebResponse ftp_Response = null/* TODO Change to default(_) if this is not a reference type */;
    string str_FtpAct = "XXX";
    string str_FtpPwd = "XXX";

    // Try to create backup folder. If folder already created, resume to backup. 
    try
    {
        ftp_Request = (FtpWebRequest)WebRequest.Create("D:/testfolder/backup");
        ftp_Request.Credentials = new NetworkCredential(str_FtpAct, str_FtpPwd);
        ftp_Request.Method = WebRequestMethods.Ftp.MakeDirectory;
        ftp_Response = ftp_Request.GetResponse();
    }
    catch (WebException ex_Web)
    {
        FtpWebResponse ftp_ResponseEx = ex_Web.Response;
        int int_ErrCode = ftp_ResponseEx.StatusCode;
        // 550: Access is denied, means directory already exist
        if (int_ErrCode != 550)
            Console.WriteLine("Create Folder Failed!");
    }

    try
    {
        ftp_Request = (FtpWebRequest)WebRequest.Create("D:/testfolder/test.txt");
        ftp_Request.Credentials = new NetworkCredential(str_FtpAct, str_FtpPwd);
        ftp_Request.Method = WebRequestMethods.Ftp.Rename;
        ftp_Request.RenameTo = "../testfolder/backup/test.txt";
        ftp_Response = (FtpWebResponse)ftp_Request.GetResponse();
    }
    catch (WebException webex)
    {
        // Get FTP Error code and exception status
        FtpWebResponse ftp_ResponseEx = webex.Response;
        int int_FtpCode = ftp_ResponseEx.StatusCode;
         // Do something
    }


    finally
    {
        if (ftp_Response != null)
            ftp_Response.Close();
    }
More...
高級水冷氣, 2020/8/4 下午 04:02:46
使用 Swiper 時, Mobile 版不能設定 slidesPerGroup, 否則會看到最後一組商品.
有點怪的 bug, mobile 版的 slidesPerGroup 只能設為 1

    var slidesPerGroup = 5;
    if (S3JS.isMobile()) {
        slidesPerGroup = 1; // 很奇怪, Mobile 版時, 若是設定 slidesPerGroup = 5 時, 剛進入時會看到最後一組商品.
    }
    //beauty-coin-exchange-loading
    var swiperPreview = new Swiper('.beauty-coin-exchange-swiper', {
        slidesPerView: 5,
        slidesPerColumn: 1,
        slidesPerGroup: slidesPerGroup,
        spaceBetween: 0,
        loop: true,
        breakpoints: {
            768: {
                slidesPerView: 4.3,
                spaceBetween: 10,
            }
        },
        nextButton: '.beauty-coin-next',
        prevButton: '.beauty-coin-prev',
    });
More...
Bike, 2019/11/22 下午 04:41:11
字串擴充
先留個言, 有空來補內容.

VB
Public Module SqlStringExtention

    <Extension()>
    Function SQLStr(ByVal Original As String) As String
        Return Original.Replace("'", "''")
    End Function

    <Extension()>
    Function SQLTrim(ByVal Original As String) As String
        Return Original.Trim.Replace("'", "''")
    End Function

End Module

C#
//Extension methods must be defined in a static class
    public static class StringExtension
    {
        /// <summary>
        /// 把 ' 取代成 ''
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string sqlStr(this string value)
        {
            return value.Replace("'", "''");
        }

        /// <summary>
        /// 假設欄位名稱中不會有 [ 或 ] 的符號
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string sqlField(this string value)
        {
            return "[" + value.Replace("[", "").Replace("]", "") + "]";
        }
    }
More...
Bike, 2017/9/30 下午 04:51:18
LINE Pay介接
LINE Pay款流程: 
reserve Page(紅科) 發送 reserve API => 取得 payment URL => 轉址到 payment URL => LINE Pay 檢查USER狀態 => 轉回confirm page(紅科), 發送 confirm API => DOWN.

付款需要程式: 
reserve API, confirm API:

send request JSON and read return JSON:
C#: 
using System.Net;
using System.IO;

public partial class TEST : System.Web.UI.Page
{
    DB.OrderMain oOrderObj = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        //Setting request header
        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("__APIRootURL__");
        httpWebRequest.ContentType = "application/json; charset=UTF-8";
        httpWebRequest.Method = "POST";
        httpWebRequest.Headers.Add("X-LINE-ChannelId", DB.SysConfig.LINEPay.ChannelId);
        httpWebRequest.Headers.Add("X-LINE-ChannelSecret", DB.SysConfig.LINEPay.SecretKey);

        //加入參數
        using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
        {
            string requestJSON = "{\"productName\": \"" + DB.SysConfig.SYSTEM_NAME + "\"," +
                                "\"productImageUrl\": \"" + DB.SysConfig.URL_Shopping + "images/Logo.jpg\"," +
                                "\"amount\": " + oOrderObj.TotalAmount() + "," +
                                "\"currency\": \"TWD\"," +
                                "\"orderId\": \"" + oOrderObj.DisplayOrderId + "\"," +
                                "\"confirmUrl\": \"" + DB.SysConfig.URL_Shopping + "Handler/LinePay/GotoComfirm.aspx?Id=" + oOrderObj.Id + "\"," +
                                "\"cancelUrl\": \"" + DB.SysConfig.URL_Shopping + "Shopping/OrderComplete.aspx?Id=" + oOrderObj.Id + "\"," +
                                "\"capture\": \"true\"," +
                                "\"confirmUrlType\": \"CLIENT\"}";

            streamWriter.Write(requestJSON);
            streamWriter.Flush();
            streamWriter.Close();
        }

        //取得回覆資訊
        var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
        //解讀回覆資訊
        using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
        {
            var responseJSON = streamReader.ReadToEnd();
            //將 JSON 轉為物件
            GN.LinePay.reserveRes.ReturnJSON oReturnObj = (GN.LinePay.reserveRes.ReturnJSON)Newtonsoft.Json.JsonConvert.DeserializeObject(responseJSON, typeof(GN.LinePay.reserveRes.ReturnJSON));

            if (oReturnObj.returnCode == "0000")
            {
                //成功
            }
            else
            {
                //失敗
                string ErrMsg = "Error Code: " + oReturnObj.returnCode + "\r\n" + oReturnObj.returnMessage;
            }
        }
    }
}


.vb
Imports System.Net
Imports System.IO

Partial Class TEST
    Inherits System.Web.UI.Page

    Dim oOrderObj As DB.OrderMain
    Private Sub Admin_TEST_Load(sender As Object, e As EventArgs) Handles Me.Load
        'Setting request header
        Dim httpWebRequest As HttpWebRequest = WebRequest.Create("__APIRootURL__")
        httpWebRequest.ContentType = "application/json; charset=UTF-8"
        httpWebRequest.Method = "POST"
        httpWebRequest.Headers.Add("X-LINE-ChannelId", DB.SysConfig.LINEPay.ChannelId)
        httpWebRequest.Headers.Add("X-LINE-ChannelSecret", DB.SysConfig.LINEPay.SecretKey)
        '加入參數
        Using streamWriter As New StreamWriter(httpWebRequest.GetRequestStream())
            Dim requestJSON As String = "{""productName"": """ + DB.SysConfig.SYSTEM_NAME + """," +
                                        """productImageUrl"": """ + DB.SysConfig.URL_Shopping + "images/Logo.jpg""," +
                                        """amount"": " + oOrderObj.TotalAmount() + "," +
                                        """currency"": ""TWD""," +
                                        """orderId"": """ + oOrderObj.DisplayOrderId + """," +
                                        """confirmUrl"": """ + DB.SysConfig.URL_Shopping + "Handler/LinePay/GotoComfirm.aspx?Id=" + oOrderObj.Id + """," +
                                        """cancelUrl"": """ + DB.SysConfig.URL_Shopping + "Shopping/OrderComplete.aspx?Id=" + oOrderObj.Id + """," +
                                        """capture"": ""true""," +
                                        """confirmUrlType"": ""CLIENT""}"

            streamWriter.Write(requestJSON)
            streamWriter.Flush()
            streamWriter.Close()
        End Using
        '取得回覆資訊
        Dim httpResponse As HttpWebResponse = httpWebRequest.GetResponse
        '解讀回覆資訊
        Using streamReader As New StreamReader(httpResponse.GetResponseStream())
            Dim responseJSON As String = streamReader.ReadToEnd()
            '將 JSON 轉為物件
            Dim oReturnObj As GN.LinePay.reserveRes.ReturnJSON = Newtonsoft.Json.JsonConvert.DeserializeObject(responseJSON, GetType(GN.LinePay.reserveRes.ReturnJSON))

            Dim ResMsg As String = ""
            If oReturnObj.returnCode = "0000" Then
                '成功

            Else
                '失敗
            End If
        End Using
    End Sub
End Class




工具網站:
JSON 轉物件 http://json2csharp.com/
C# to VB : http://converter.telerik.com/



#專案: 紅科
More...
Reiko, 2017/6/21 下午 07:22:58
網站同時使用 C# 與 VB.net
由於早期網站都是VB.net寫的,若是直接換成 C#,就會耗費很多時間在轉換程式上
因此 ASP.NET 特別可以在同一網站同時寫 vb 跟 C#,方式是在 web.config compilation 加上設定
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
     <codeSubDirectories>
        <add directoryName="VB_Code"/>
        <add directoryName="CS_Code"/>
     </codeSubDirectories>
    </compilation>

也就是 VB.NET 的 code 就放到 ~\APP_Code\VB_Code 目錄
C# 的 code 就放到 ~\APP_Code\CS_Code 目錄
這樣做有兩點要注意
1.  Namespace 的命名,最好不要互相衝突, 要能夠區分出來
2.  VB_Code 與 CS_Code 放的位置有很大的影響, 因為牽涉到 compiler的先後順序,因為 VB_Code 在 CS_Code 在前面,所以 CS_Code可以叫用 VB_Code下的程式,但是 VB_Code 卻不能叫用 CS_Code 的程式,如果希望 VB_Code可以叫用 CS_Code的程式,就把設定換過來
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
     <codeSubDirectories>
        <add directoryName="CS_Code"/>
<add directoryName="VB_Code"/>
     </codeSubDirectories>
    </compilation>

缺點就是反過來 CS_Code不能使用 VB_Code的程式

基本上,若是舊的程式碼都在VB_Code 那就把 VB_Code 放到前面
More...
darren, 2017/5/10 下午 02:21:54
中文難字的繁簡轉換處理
看到黑暗有一個關於中文難字的繁簡轉換處理的文章, 先記錄部份在這裡.

http://blog.darkthread.net/post-2015-03-06-strconv-half-full-width-notes.aspx

      var ncrString = toNCR("黑暗執行緒犇ABC123");
      Debug.WriteLine(ncrString); //黑暗執行緒&#29319;ABC123
      var convString = Microsoft.VisualBasic.Strings.StrConv(
        ncrString, Microsoft.VisualBasic.VbStrConv.Narrow, 1028);
      Debug.WriteLine(convString); //黑暗执行绪&#29319;ABC123
      var resultString = fromNCR(convString);
      Debug.WriteLine(resultString); //黑暗执行绪犇ABC123


    static string toNCR(string input)
    {  
      StringBuilder sb = new StringBuilder();
      Encoding big5 = Encoding.GetEncoding("big5");
      foreach (char c in input)
      {
        //強迫轉碼成Big5,看會不會變成問號
        string cInBig5 = big5.GetString(big5.GetBytes(new char[] {c}));
        //原來不是問號,轉碼後變問號,判定為難字
        if (c!='?' && cInBig5=="?")
          sb.AppendFormat("&#{0};", Convert.ToInt32(c));
        else
          sb.Append(c);
      }
      return sb.ToString();
    }
 
    static string fromNCR(string input)
    {
      return Regex.Replace(input, "&#(?<ncr>\\d+?);", (m) =>
      {
        return Convert.ToChar(int.Parse(m.Groups["ncr"].Value)).ToString();
      });
    }
More...
Bike, 2016/11/21 下午 12:40:54
Bdodo Server
這是一篇加密文章,需輸入密碼才可閱讀
More...
Bike, 2015/3/13 下午 06:25:53
使用Linq取得CheckBoxList多選值
取得CheckBoxList多選值的方式:

【未使用Linq的寫法】

       Dim values = New List(Of String)()
       For Each item As ListItem In Me.CheckBoxList1.Items
             If item.Selected Then
                  values.Add(item.Value)
             End If
       Next

       Dim result = String.Join(",", values.ToArray(Of String)())
 

【使用Linq的寫法】

               Dim result = String.Join(",", Me.CheckBoxList1.Items.Cast(Of ListItem)() _
                                   .Where(Function(x) x.Selected) _
                                   .[Select](Function(x) x.Value).ToArray())

p.s. Linq需使用.NET Framework 3.5以上的版本
More...
candice, 2014/11/26 下午 04:57:30
Fixing Windows 2008 R2 Activation Errors
http://lifeofageekadmin.com/fixing-windows-2008-r2-activation-errors/

​Location is at C:\windows\system32\Slmgr.vbs
/ckms = clear all KMS servers in cache and set to auto discover
/skms :  = Specify a KMS host server
/ipk  = Enter in a new license key
/ato = Activate the new key
/dlv = Display license information
First open a command prompt and try to register a license key. This example is for Windows 2008 R2 Enterprise Edition.
C:\> Cd c:\windows\system32
C:\Windows\system32>cscript slmgr.vbs /ipk
C:\Windows\system32>cscript slmgr.vbs /ato
If you receive activation successful you are complete. If you receive a 0xC004F074 error do the following.
C:\> Cd c:\windows\system32
C:\Windows\system32>cscript slmgr.vbs /ckms
C:\Windows\system32>cscript slmgr.vbs /ipk
C:\Windows\system32>cscript slmgr.vbs /ato
If you receive activation successful you are complete. If you receive a 0xC004F074 error again or another error do the following.
C:\> Cd c:\windows\system32
C:\Windows\system32>cscript slmgr.vbs /rilc
Reboot
C:\> Cd c:\windows\system32
C:\Windows\system32>cscript slmgr.vbs /ckms
C:\Windows\system32>cscript slmgr.vbs /ipk
C:\Windows\system32>cscript slmgr.vbs /ato
More information can be found at Configuring KMS Clients
More...
Bike, 2014/11/3 下午 04:49:25
IsNumeric 以及 Convert.ToInt32(char) 要注意的狀況
最近做一些int型別轉換的時候,發現一些現象,以後寫code的時候要注意

1. VB.NET IsNumeric 用逗號可以過,例如 IsNumeric("1234,5678") ==> True
   但是轉型別 CInt or Convert.ToInt32 就會出錯,所以用 IsNumeric 不是很保險,最好用 int.TryParse

2. Convert.ToInt32(char) 會抓出該 char 的 ascii code, 而不是該文字代表的數字
   Convert.ToInt32('9') ==> 57  (C# 用單引號代表是 char)
   Convert.ToInt32("9") ==> 9
   Convert.ToInt32('A') ==> 65  (C# 用單引號代表是 char)
   Convert.ToInt32("A") ==> error: 輸入字串格式不正確。
More...
darren, 2014/10/28 下午 07:10:28
|< 1234 >|
頁數 1 / 4 下一頁
~ Uwinfo ~