VB.NET WebClient Proxy Not Connecting To Google - vb.net

I'm working on a small application that can query google from the WebClient class in VB.NET. I noticed that the WebClient queries Google just fine without the proxy property being added, but I'd like to also have the capability of using proxies to connect to Google as well and it just isn't working. Here's the code that I have:
Try
Dim wc As New System.Net.WebClient()
'This line below will bring in the "User Agent" to make the HTTP request:
wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36")
Dim wp As New System.Net.WebProxy(TextBox1.Text)
wc.Proxy = wp
Dim HTML As String = wc.DownloadString("https://www.google.com/search?q=spider+man")
TextBox1.Text = HTML
Catch ex As Exception
MsgBox(ex.Message)
End Try
The problem is that NOTHING comes back even though I know that I'm using an ALIVE proxy (working public proxy) as it's connects through other browser applications perfectly to Google. Some how Google is blocking my application because it's apparently missing something. I have the headers setup correctly, so I know it can't be that (or at least I believe that I have them setup correctly).
Would appreciate any support.

Related

How to access COWIN APIs?

I want to access these APIs from cowin.gov.in
This API is for getting the vaccination certificate -
https://ndh.digitallocker.gov.in/public/marketplace/api/cowin/cowincert
But when I access this using mobile number and a beneficiary ID , I get unauthorized access.
It requires to generate token and require following this from this site - https://openapi.aarogyasetu.gov.in/profile
I am integrating this to my Flutter App how can I get the following
Your Public Key (Callback data will be signed using this)
Callback URL
I am an individual using this API but it needs some company info too. What should I do?
Check this image for more details of registration
I checked the website https://openapi.aarogyasetu.gov.in/ and got the contact details
openapi.aarogyasetu#gov.in. Please try to send a mail to this id and lets see what they are going to respond. I am not sure whether individuals can get access to those API's since they are asking a lot of information about company/organization.
As stated in the image below, We might need to contact the Ministry of Health and Family Welfare, Government of India to get access to the protected APIs.
You can now raise your issues on https://github.com/cowinapi/developer.cowin
This is official github repository of COWIN
You can check all the open issues as well the closed issues for clarifications.
You don't need an api key for accessing the public api end points
mention general user agent like this {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.56"} to avoid getting the error.
Co-WIN Public APIs allow any third-party application to access certain un-restricted information, that can be shared with its users. This is limited only to read access in Co-WIN. The appointment availability data is cached and may be up to 5 minutes old. Further, these APIs are subject to a rate limit of 100 API calls per 5 minutes per IP.
Swager API documentation official resource
https://apisetu.gov.in/public/api/cowin/cowin-public-v2
header = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'origin': 'https://selfregistration.cowin.gov.in/',
'referer': 'https://selfregistration.cowin.gov.in/'
}
also needs
data = {"mobile": mobile,
"secret": "U2FsdGVkX1+z/4Nr9nta+2DrVJSv7KS6VoQUSQ1ZXYDx/CJUkWxFYG6P3iM/VW+6jLQ9RDQVzp/RcZ8kbT41xw=="
}
source
https://github.com/pallupz/covid-vaccine-booking/

WebClient request fails because client is seen as outdated browser

I'm attempting to download an HTML response from a website but I keep getting the following response: The security settings for your Internet browser or device appear to be out of date. Please upgrade now.
I've attempted to use every User-Agent setting I could find but I'm still receiving the same error. I've also tried the HTTPWebRequest method and received the same error.
The request works fine when I open IE or Chrome and type URL.
Here is my code:
string url = #"https://www.royalmail.com/track-your-item?trackNumber=" + track.TrackingNumber;
WebClient client = new WebClient();
client.Headers.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)");
string content = client.DownloadString(url);
Example of URL that I'm trying to call: https://www.royalmail.com/track-your-item?trackNumber=FP065628015GB
You should use TLS1.2 as your security protocol for this site.
This line should fix your problem.
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

OKTA API not exporting Source address details

I have created an OKTA API using token and admin account url to export the events(logs) reffered to the activities done on my okta account.
i am able to export the events but the IP address details or the source IP (from where) info is not getting exported.
anything more need to added to API for the same. please advise.
Modify Okta API com.okta.sdk.models.event.Actor.java
Add a property:
private String ipAddress;
Add get/set funcitons.
Compile source code to a new Okta API jar, use this jar substitute the original one, then you will get your IpAddress attribute value in event.actor.ipAddress
The ipAddress depends on the Actor objectType. Events with a Client ObjectType will include the ipAddress as shown in the example below:
{
"id": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36",
"displayName": "CHROME",
"ipAddress": "127.0.0.1",
"objectType": "Client"
}
One way to debug this would be to use the public Events API and filter the events to validate that for the ipAddress is getting captured for the appropriate Events. If the ipAddress is included in the JSON response but is not getting parsed in the CSV export, then you may have uncovered a bug. That said, I just tested this and it worked for me ;-)

ASP.NET SMS Gateway API

I purchased a SMS gateway for which they gave me only HTTP and XML API but I need ASP.NET API to work on my project. Can anybody help me how to convert the below API to ASP.NET(c#) API.
HTTP API
http://indiansms.smsmaker.in/api/sendmsg.php?user=*********&pass=********&sender=Sender ID&phone=Mobile No&text=SMS&priority=Priority&stype=smstype
XML API
$data="<?xml version='1.0' encoding='utf-8'?>
<MESSAGE>
<USERNAME>username</USERNAME>
<PASSWORD>password</PASSWORD>
<TEXT>Hi, this is a test message</TEXT>
<PRIORITY>ndnd</PRIORITY>
<SENDER>SenderId</SENDER>
<MSGTYPE>normal</MSGTYPE>
<ADDRESS>*********</ADDRESS>
<ADDRESS>*********</ADDRESS>
</MESSAGE>";
How to convert this API to ASP.NET API.
I know that this question is unqualified to post it here. But I need it immediately.
I have done something similar from an .Net application where we used the http api to send sms. We used the webclient in .net to send messages.
using (var client = new WebClient())
{
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)");
client.QueryString.Add("user", "username");
client.QueryString.Add("pass", "password");
// Add all the parameters you need
using (Stream stream = client.OpenRead("http://indiansms.smsmaker.in/api/sendmsg.php"))
{
// Do something with the response..
}
}

When an Adobe AIR app requests a resource from the server what shows as user agent?

When a browser like Chrome makes a request for a web page or image like a gravatar icon the server receives the userAgent information like so:
"Chrome/2.0 AppleWebKit/400.1.1 (KHTML, like Gecko)"
But if an Adobe AIR app makes a request for an image in the Image component what does the server receive? Is the same as a URLRequest?
"Chrome/2.0 AppleWebKit/400.1.1 (KHTML, like Gecko) AdobeAIR/3.0"
Background:
My AIR app shows Gravatar icon for the user and recently it stopped working. I'm wondering if it's gravatar is denying calls from user agents it doesn't recognize.
I've tried changing the userAgent to test the theory and it's throwing an error:
// 1195: Attempted access of inaccessible method userAgent through a reference with static type Class.
URLRequestDefaults.userAgent("chrome");
Update:
It looks like I need to set the user agent as a property and not a method. Was referring to this forum post. So I can change that might fix the gravatar issue but not answer how Adobe AIR apps appear to the server.
i hope this result's comes useful
Mozilla/5.0 (Windows; U; en-US) AppleWebKit/533.19.4 (KHTML, like
Gecko) AdobeAIR/3.1
also i cant realize that what's difference between requesting for an Image and URLRequest, they are same.