In this post you will learn how to use SSIS Script Task (C# Code) to detect specific URL found or not (Detect HTTP 404 Error)
If you using SSIS JSON Source or our REST API Task then if URL/Document you trying to read not found then server may return 404 (Not Found) Exception. In order to handle this error gracefully you can use following Script to store status in a variable and then you can use conditional Control Flow to Skip data loading from Web Service.
Step1: Drag Script Task from toolbox
Step2: Select Language as C#
Step3: Select Readonly variable (In this case “User::url” – String Type)
Step4: Select ReadWrite variable (In this case “User::found” – Boolean Type)
Step5: Edit code and paste following script in your script task