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
標籤
  • PG
  • Su
  • 交易記錄已滿
  • 392
  • 2873
  • SqlCache21
  • uw
  • C
  • VS
  • asp2121121
  • 918
  • backup
  • 80
  • sqlcach
  • 8360
  • -2810
  • 上傳檔案太大
  • 60
  • 26
  • 耗時
  • CROS
  • 問題
  • sca
  • RequestEnc
  • 移至定義
  • .
  • Rf
  • 44
  • datetime
  • sysconfig
  • [u2]
  • date
  • find
  • net2121121
  • EN
  • 272
  • date[t] OR
  • ad
  • ef
  • div
  • 1z5JIPhd
  • 162
  • if
  • 352
  • query
  • 15.1MQtn
  • blog
  • output[t]
  • 版本
  • TextWriter
頁數 1 / 4 下一頁
搜尋 jq 結果:
解決 jquery XSS問題,升級到 3.5 版以上之相關處理
最近因為資安公司要求,要把 jQuery 升級到最新版
網路查了一下,似乎 3.5 版以後, XSS 才算是改善很多

目前最新版本是 3.7.0,對於原本就使用 3 以上版本專案影響就不大,所有 function 沿用上沒有問題
但是有些舊專案使用 2.X 甚至 1.X 升級到 3.7.0 版之後就會有些功能掛掉

經測試,首當其衝的就是 $(window).load 不能使用,更精準一點應該是 .load() 不能使用
檢查 jquery 過期網頁 https://api.jquery.com/category/deprecated/
發現 .load() 是 1.8 版以後 deprecated,但我 2.2.4 用很久用爽爽
我想應該是 jquery 為了相容問題,一直到跨版本才真的拿掉
也就是 1.X 宣告 deprecated 的功能,到 3.X 才真的移除
(請看附圖)
所以我就鴕鳥的找 1.X  deprecated 然後可能會用的 function 處理
(若有 tag "Removed" 就是已移除,這樣找比較快)
.andSelf()
.live()
.die()
.error()
.load()
.unload()
.size()
.toggle()

大致上專案搜尋字串應該就能處理
但有些可能是其他第三方 jquery物件 例如 jquery-ui ,會用到以上功能
這時可能要去該物件看有無對應升級版
 
More...
darren, 2023/7/20 上午 11:08:33
另開新視窗測試 -- 待測試
Browser:
safari in iphone 
chrome in iphone
chrome in android
in Line (APP)
in FB (APP)

HTML:
form target="_blank"
window.open
link target="_blank"

Trigger:
onclick in tag
.click with jquery
submit button
More...
Bike, 2022/2/11 上午 09:13:12
CORS 實做 (jQuery + ASP.NET Core Web API)
加構獨立的 API Server 時, 要使用 Cookie 認証必需有以下條件:

1. Web Server 和 API Server 有相同的父網域.
2. Cookie 的網域指定到相同的父網域.
3. 在 API 的 Application 中允許 CORS Request, 需要修改 Startup.cs

3.1 在 ConfigureServices 中要加入  AddCors, 而且要記得 AllowCredentials()
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy(name: "Cors(PolicyName",
                                 builder =>
                                 {
                                     builder.WithOrigins("https://web1.yourdomain.com",
                                                         "https://web2.yourdomain.com")
                                     .AllowCredentials();
                                 });
            });

            services.AddControllers()
                .AddNewtonsoftJson(opt =>
                 opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver());


3.2 在 Configure 中, 要加入 app.UseCors("Cors(PolicyName"), 記得要在  UseAuthorization() 之前.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseExceptionMiddleware();

            app.UseHttpsRedirection();

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseCors(MyAllowSpecificOrigins);

            app.UseAuthorization();



4. 在 Client 端要加上 withCredentials: true
                            $.ajax({
                                url: apiRoot + "apiurl",
                                type: 'GET',
                                dataType: 'json', // 預期從server接收的資料型態
                                success: function (res) {
                                    console.log("success: ");
                                    console.log(res);                                    
                                },
                                xhrFields: {
                                    withCredentials: true
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    alert("發生錯誤");
                                }
                            });
More...
Bike, 2021/10/24 下午 05:17:54
試題
試說明以下程式碼的功用, 以及可改進的部份.


        string EndDate = Request["EndDate"];

        DataTable qtyControls = U2.SQL.DTFromSQL("Select YA00, PD00 from QtyControl Where EndDate > '" + EndDate + "' and SoldQty >= InitQty");

        var values = qtyControls.AsEnumerable().Select(r => "('" + r.Field<string>("YA00") + "','" + r.Field<string>("PD00") + "')").ToList();

        var sqls = new List<string>();
        sqls.Add("Delete StopSaleYAP;");

        int start = 0;        
        while(start < values.Count)
        {
            var end = start + 999;
            if(end > values.Count - 1)
            {
                end = values.Count;
            }

            sqls.Add("insert into StopSaleYAP(YA00, PD00) Values" + string.Join(",", values.GetRange(start, end)) + ";");

            start = end + 1;
        }

        U2.SQL.ExecuteSQL(string.Join("\r\n", sqls));


        public static bool IsErrorOrder(Order.Input.CheckValidOrder dto)
        {
            if (dto.OrderNos == null || dto.OrderNos.Count == 0)
            {
                return false;
            }

            var orderCount = dto.OrderNos.Count();
            var orders = NpreoOrderMain.GetList(dto.OrderNos);
            if (orders.Count != orderCount || !dto.OrderNos.Any(x => orders.Select(o => o.Order_No).Contains(x)))
            {
                return true;
            }
            return false;
        }


        var fu = Request.Files[0];
        fu.SaveAs(Server.MapPath("UploadFiles/") + fu.FileName);


--

基本題:

1. 對 Linq 熟嗎.

2. 對 ASP.Net 的 Cache  熟悉嗎.

3. 用過什麼 ORM, 試說明優缺點.

4. 試說明 MVC 的架構.

資安相關問題:

1. 試說明 SQL Injection

2. 試說明 Cross Site Injection.

3. 上傳檔案要注意的事項.

4. 試說明 cookie 的安全設定 ? same site, secure, http only.


前端相關加分題:

1. jQuery 或 Vue 熟悉嗎 ?

2. 試說明 RWD

3. 試說明 bootstrap

進階問題:

1. 試說明 Reflection

2. 試說明 Dependency Injection

3.  試說明 singleton vs static

4. 試單有兩個欄位 Id, Status (付款待確認: 1.1;  已付款: 2,  訂單已出貨: 3; 訂單取消中: 5; )
狀態 1.1 和 狀態 2 的訂單可取消,取消後改為狀態 5

客人要取消訂單,訂單編號為 123, 試說明程式執行的過程。
More...
Bike, 2020/10/24 上午 10:24:51
[錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
錯誤訊息:
WebForms UnobtrusiveValidationMode 需要 'jquery' 的 ScriptResourceMapping。請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)。

解決方式:
在有用 validation 那頁的 Page_Load 加上,就恢復正常了
protected void Page_Load(object sender, EventArgs e)
{
     UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
}

參考來源:
https://blog.xuite.net/tolarku/blog/63451508-VS+2012+%E5%88%9D%E9%AB%94%E9%A9%97+-+%E9%9C%80%E8%A6%81+%27jquery%27+%E7%9A%84+ScriptResourceMapping+%E9%8C%AF%E8%AA%A4
https://www.c-sharpcorner.com/UploadFile/cd7c2e/enabling-unobtrusive-validation-mode-in-Asp-Net-4-5/
More...
choco, 2019/7/9 上午 09:37:20
使用IntersectionObserver API 實作 Lazy load
過去都是使用 jquery lazy load js 來實作延遲載圖,
其運作原理是偵測scroll事件以及img物件的相對位置來決定要不要load圖片

現在有更簡單的方式,就是用 IntersectionObserver API 這個 Web標準
來偵測 img 物件是不是進入可視 webview 範圍
https://developers.google.com/web/updates/2016/04/intersectionobserver

document.addEventListener("DOMContentLoaded", function() {
var lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));;

if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype) {
    let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
     entries.forEach(function(entry) {
        if (entry.isIntersecting) {
         let lazyImage = entry.target;
         lazyImage.src = lazyImage.dataset.src;
         lazyImage.srcset = lazyImage.dataset.srcset;
         lazyImage.classList.remove("lazy");
         lazyImageObserver.unobserve(lazyImage);
        }
     });
    });

    lazyImages.forEach(function(lazyImage) {
     lazyImageObserver.observe(lazyImage);
    });
}
//這裡可以加上else處理萬一瀏覽器不支援的狀況
});


網頁裡面只要用  <img data-src='圖片網址' class='lazy' />  就可以啦

IntersectionObserver API
目前 Can I Use 網站顯示大部分 browser 都支援,iOS safari 要 12.2 版才支援
應該可以放心使用


 
More...
darren, 2019/4/3 下午 07:48:07
DOM 物件隱藏後,用 jquery 的 each function 會永遠抓到第一個物件..
        var TotalOldQty = 0;
        $(".AdjQty_" + yano + "_" + pdno + " [type='text']").each(function () {
            TotalOldQty += parseInt($(this).data("oldqty"));
        });

        $(".AdjQty_" + yano + "_" + pdno).html($(".AdjQty_" + yano + "_" + pdno).html() + "更新中.....");

        $(".AdjQty_" + yano + "_" + pdno + " span").hide();


和 

        $(".AdjQty_" + yano + "_" + pdno).html($(".AdjQty_" + yano + "_" + pdno).html() + "更新中.....");

        $(".AdjQty_" + yano + "_" + pdno + " span").hide();

        var TotalOldQty = 0;
        $(".AdjQty_" + yano + "_" + pdno + " [type='text']").each(function () {
            TotalOldQty += parseInt($(this).data("oldqty"));
        });


出來的 TotalOldQty 會不相同..
More...
Bike, 2017/7/4 下午 03:36:43
jQuery Tip
jQuery 的參數提示總是 a, b, c 的看不懂 ? 請參考下圖:



上圖是引用 jquery-2.2.4.js 的結果.

下圖是引用 jquery.min.js 的結果.

大家會使用 jquery.min.js 的主要原因是, 主要是檔案大小"大幅縮小" 剩下 25% 左右. 但是....

減少的 75% = 270K, 而且只有第一次載入時會真的下載檔案.

所以要用哪一個呢 ? 這就留給你判斷了...
More...
Bike, 2017/6/17 上午 09:35:03
jQquery 的 data 會刪除開頭的 0
<a class="del" href="#" data-yano="1250453286" data-pdno="04360003">
    <img src="/TC/template/Shopping/images/del.png" alt="">
</a>


用 $(".del").data("pdno") 會回傳 4360003
被這個搞了好久..

要避免這個問題, 可以使用 attr  來代替 data
$(".del").attr("data-pdno")
More...
Bike, 2017/6/13 下午 09:35:57
用 Jquery 增加 Option 的漂亮寫法.
用 Jquery 增加 Option 的漂亮寫法.

$("#select").append($("<option></option>").attr("value", "值").text("文字"));


其它更多可以參考: ​https://dotblogs.com.tw/alanjiang/2011/01/26/21061
More...
Bike, 2016/12/20 下午 09:14:54
|< 1234 >|
頁數 1 / 4 下一頁
~ Uwinfo ~