This is a suggestion as I have not verified this ...
When the WebRequest fails and returns -1, check the last error code.
I suspect that one of the returned error codes, possibly error code 5200, may be a good indicator of when the URL is not defined in the Options "Allowed" filter.
However, I don't think this will be fool-proof. Just a good indication of the situation.
Operations with WebRequest
ERR_WEBREQUEST_INVALID_ADDRESS
5200
Invalid URL
ERR_WEBREQUEST_CONNECT_FAILED
5201
Failed to connect to specified URL
ERR_WEBREQUEST_TIMEOUT
5202
Timeout exceeded
ERR_WEBREQUEST_REQUEST_FAILED
5203
HTTP request failed
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
However in the Allowed URL user input https://abc.com because when copy pasting from browser the www gets neglected.
The web-request fails in this case as the web request returns -1.
My understanding is Allowed URLs list cannot be accessed to determine in advance.
One way to overcome this is to have the code see if the previous web-request returned -1, replace the "www" and try again.
Can anyone suggest a different solution?
Thank you.