2017年6月23日 星期五

[研究] [C#] [ASP.NET] 用 SweetAlert 作 刪除確認 提示對話盒

[研究] [C#] [ASP.NET] 用 SweetAlert 作 刪除確認 提示對話盒

2017-06-128

Visual Studio 2017
請用 Nuget 安裝 SweetAlert.Base 和 jQuery

[研究] ASP.NET + SweetAlert 安裝 (NuGet)與試用
http://shaurong.blogspot.com/2017/06/aspnet-sweetalert-nuget.html

[研究][C#][ASP.NET] jQuery 3.1.1 安裝(NuGet)
http://shaurong.blogspot.com/2017/01/caspnet-jquery-311-nuget.html

參考這篇

SweetAlert confirmation dialog with asp.net listview delete?
https://stackoverflow.com/questions/33522843/sweetalert-confirmation-dialog-with-asp-net-listview-delete

下面 LinkButton1 會跳出傳統的對話盒視窗,LinkButton2 跳出 SweetAlert 版的。

<%@ page language="C#" autoeventwireup="true" codebehind="Default.aspx.cs" inherits="WebApplication1.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="Scripts/sweetalert.min.js"></script>
    <link href="Styles/sweetalert.css" rel="stylesheet" />
    <script src="Scripts/jquery-3.1.1.js"></script>

    <script type="text/javascript">
        function deletealert(ctl) {
            // STORE HREF ATTRIBUTE OF LINK CTL (THIS) BUTTON
            var defaultAction = $(ctl).prop("href");
            // CANCEL DEFAULT LINK BEHAVIOUR
            event.preventDefault();
            swal({
                title: "警告",
                text: "刪除確認?",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "Yes, delete it!",
                cancelButtonText: "No, cancel plx!",
                closeOnConfirm: false,
                closeOnCancel: false
            }, function (isConfirm) {
                if (isConfirm) {
                    swal("Deleted!", "Your imaginary file has been deleted.", "success");
                    // RESUME THE DEFAULT LINK ACTION
                    eval(defaultAction);
                    return true;
                } else {
                    swal("Cancelled", "Your imaginary file is safe :)", "error");
                    return false;
                }
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:LinkButton ID="LinkButton1"  runat="server" OnClientClick='return confirm("確定刪除?")' OnClick="LinkButton1_Click" PostBackUrl="~/WebForm1.aspx">LinkButton</asp:LinkButton><br />
            <asp:LinkButton ID="LinkButton2"  runat="server" OnClientClick='return deletealert(this, event);' OnClick="LinkButton1_Click" PostBackUrl="~/WebForm1.aspx">LinkButton</asp:LinkButton><br />
            <asp:LinkButton ID="LinkButton3"  runat="server" OnClientClick='return deletealert(this, event);' OnClick="LinkButton1_Click" >LinkButton</asp:LinkButton><br />
        </div>
    </form>
</body>
</html>


(完)

2017年6月22日 星期四

[研究] [ASP.NET] e.NewValues 與 並未將物件參考設定為物件的執行個體。

[研究] [ASP.NET] e.NewValues 與 並未將物件參考設定為物件的執行個體。

2017-06-22

Visual Studio 2017 + C# + ASP.NET + WebForm

e.NewValues["ContextResponse"] 的 ContextResponse 是 Bind 的欄位值,不是 TextBox 或 Label 的 ID 值。

如果 ContextResponse 欄位沒填寫內容,是不能作 ToString() 的,因為 e.NewValues["ContextResponse"] 會是 null,null 不能作 ToString()。

      protected void DetailsView2_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            string errMessage = "";

            //TextBox TextBox_ContextResponse = (TextBox)DetailsView2.FindControl("TextBox_ContextResponse");
            //string ContextResponse = TextBox_ContextResponse.Text;
            //if (TextBox_ContextResponse.Text == "")
            //    errMessage = errMessage + "「XX欄位」必填。";

            // 如果 ContextResponse 欄位沒填寫內容,是不能作 ToString() 的
            //if (e.NewValues["ContextResponse"].ToString().Trim() == "")    // 並未將物件參考設定為物件的執行個體。
            //if (e.NewValues["ContextResponse"].ToString() == "")           // 並未將物件參考設定為物件的執行個體。
            //string ContextResponse = e.NewValues["ContextResponse"].ToString().Trim();    // 並未將物件參考設定為物件的執行個體。
            //string ContextResponse = e.NewValues["ContextResponse"].ToString();    // 並未將物件參考設定為物件的執行個體。
            //string ContextResponse = ((String)e.NewValues["ContextResponse"]);        // 並未將物件參考設定為物件的執行個體。
            //if (e.NewValues["ContextResponse"].ToString() == "")
            if (e.NewValues["JiguanResponse"] == null)
            {
                errMessage = errMessage + "「XX欄位」必填。";
            }
            else
            {
                if (e.NewValues["JiguanResponse"].ToString().Trim() == "")
                    errMessage = errMessage + "「XX欄位」請勿只填寫空白。";
            }
         }

(完)

2017年6月17日 星期六

[研究] OpenVAS 9 安裝

[研究] OpenVAS 9 安裝

2017-06-17

OpenVAS 是很有名的 開放原始碼弱點掃描和管理工具 ( Open Source vulnerability scanner and manager )。

下載網址
http://www.openvas.org/vm.html

OpenVAS 4.0.5 (corresponds to OpenVAS-9)
gsm_ce_4.0.5.iso
339 MB (355,794,944 位元組)

需求
Type: Linux
Version: Other Linux (64bit) => 敝人用 VMware Workstation,選 Debain 64-bits
Memory: 2048M
Harddisk: 9G
CPUs: 2
Create a new hard disk for the virtual machine.

























(完)

[研究] OpenVAS 9 安裝
http://shaurong.blogspot.com/2017/06/openvas-9.html

[研究] OpenVAS-8 DEMO Virtual Appliance 1.0 安裝
http://shaurong.blogspot.com/2015/05/openvas-8-demo-virtual-appliance-10.html

[研究] OpenVAS-7 DEMO Virtual Appliance 2.4 安裝
http://shaurong.blogspot.com/2015/03/openvas-7-demo-virtual-appliance-24.html

[研究] OpenVAS 7 安裝與使用(yum)(CentOS 7.0 x64)
http://shaurong.blogspot.com/2014/11/openvas-7-yumcentos-70-x64.html

[研究] OpenVAS 6 安裝與使用(yum)(CentOS 7.0 x64)
http://shaurong.blogspot.com/2014/08/openvas-6-yumcentos-70-x64.html

[研究] OpenVAS 6.0 beta 5 安裝與使用(yum)(Fedora 20 x64)
http://shaurong.blogspot.com/2014/02/openvas-60-beta-5-yumfedora-20-x64.html

[研究] OpenVAS 安裝與使用(yum)(CentOS 6.5 x64)
http://shaurong.blogspot.com/2014/01/openvas-yumcentos-65-x64.html




[研究] Acunetix Web Vulnerability Scanner (AWVS) 11 Trial 下載、安裝、試用

[研究] Acunetix Web Vulnerability Scanner (AWVS) 11 Trial 下載、安裝、試用

2017-06-17

11.0 和舊版 10.x、9.x、8.x 差異很大,變成本機的 Web-Based 介面的軟體。

Acunetix Web Vulnerability Scanner 簡稱 AWVS,或 Acunetix WVS,是出名的黑箱測試、滲透測試掃描工具。

官方網站
http://www.acunetix.com/

14天試用版下載 (舊版只提供 SQL Injection 和 Cross-Site Scripting 掃描,不提供產生報告功能)
http://www.acunetix.com/vulnerability-scanner/download/
輸入資料後,會寄出 Email 到你輸入的 Email 信箱中,裡面包含下載網址和相關資訊。

Dear  *****,

Thank you for your interest in Acunetix!

Download your Acunetix 14-day Trial Edition, and Sample Reports here:
http://www.acunetix.com/download-8991-2

The Trial Edition allows you to scan any web site operated by you. You will be informed of vulnerabilities detected but the vulnerability details and solutions are only shown for the Acunetix test web sites"

In addition, you can review the full scan results including vulnerabilities detected using AcuSensor, by running a scan against one of these Acunetix test sites:
- http://testphp.vulnweb.com
- http://testasp.vulnweb.com
- http://testaspnet.vulnweb.com
- http://testhtml5.vulnweb.com

The Acunetix user manual may be downloaded here:
http://www.acunetix.com/resources/wvsmanual.pdf

We also maintain a support FAQ and a Web Application Security blog which answers common support and web security questions:
http://www.acunetix.com/blog
http://www.acunetix.com/support/

Should you have any sales queries, please do not hesitate to email me at jma@acunetix.com or call on

Sales APAC: +44 (0)330 202 0190
Support APAC: +44 (0)330 202 0193

To stop receiving further notifications on the above, please click here: https://erp.acunetix.com/downloads/downloads/unsubscribe.aspx?i=cjjxazkqqlgjuzsh

Thanks and regards,

Jean-Michel Azzopardi
Regional Sales Executive
Acunetix
jma@acunetix.com

------------------------------------------------------------
Product ID: WVSDEMOB
Product Name: Acunetix Demo B



下載得到檔案 acunetix_trial.exe,43.8 MB (45,930,232 位元組)

商業版本定價
http://www.acunetix.com/ordering/

11.0 Trial 直接下載
http://www.acunetix.com/download-8991-2

舊版直接下載 ( 有可能不存在了)
http://www.acunetix.com/vulnerability-scanner/vulnerabilityscanner.exe

軟體是 2016-05-26 下載,在 Windows 7 x64上測試
























新增說明文字






(完)

相關

[研究] Acunetix Web Vulnerability Scanner (AWVS) 11 Trial 下載、安裝、試用

[研究] Acunetix Web Vulnerability Scanner (AWVS) 10 Trial 試用
http://shaurong.blogspot.com/2016/05/acunetix-web-vulnerability-scanner-awvs.html

[研究] Acunetix Web Vulnerability Scanner (AWVS) 9.5 Trial 試用
http://shaurong.blogspot.com/2014/07/acunetix-web-vulnerability-scanner-95.html

[研究] Acunetix Web Vulnerability Scanner (AWVS) 8 Trial 試用
http://shaurong.blogspot.com/2013/08/acunetix-web-vulnerability-scanner-8_31.html