473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Checking a URL :Valid or Invalid

Hi All,
Could any body help me. Regarding how to check a URL is
Valid or
Invalid.
I am using Four functions to check the same.
1) hConnect = WinHttpConnect( hSession, "www.google.co.in",
INTERNET_DEFAULT_HTTPS_PORT, 0);
2) hRequest = WinHttpOpenRequest( hConnect,
"{GET}",
pUrl, /// "/sea123rch?
hl=en&q=flow123ers&meta="
NULL,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_BYPASS_PROXY_CACHE );
3) bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS, 0,
WINHTTP_NO_REQUEST_DATA, 0,
0, 0 );
4) bResults = WinHttpReceiveResponse( hRequest, NULL );

Here is my observation when I have given the wrong URL in
WinHttpOpenRequest(..pUrl..), it has to throw the
ERROR_WINHTTP_INVALID_URL or at least WinHttpSendRequest() has to
thorw the Exception but I haven't getting this.
Would I have to set any flag to check URL is valid or not please if
any Sample code would be good.
Can any body please help me out to sort out this problem.
Here is the example for Valid and Invalid URL:
Valid URL:
http://www.google.co.in/search?hl=en&q=flowers&meta=
Invalid URL:
http://www.google.co.in/sea123rch?hl...ow123ers&meta=
Regards,
Rs.

Jul 30 '07 #1
0 1755

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4956
by: news | last post by:
There's all kinds of ways to validate an email address to make sure it's well formed and whatnot, but what about checking to see if it's a valid e-mail account? Like how you can use checkdnsrr()...
7
7551
by: - ions | last post by:
I have created a JComboBox with its Items as a list of "M" numbers ie. M1,M2,M3.......throgh too M110 (thes are the messier objects, a catolouge of deep sky objects) the user selects of of these...
3
1871
by: Guy Robinson | last post by:
I have the code below which parses an expression string and creates tokens. Can anyone suggest the best of error checking for things like: Valid variable only obj.attribute -whitespace allowed...
5
11031
by: William Payne | last post by:
Hello, I am in the process of converting a C++ program to a C program. The user of the program is supposed to supply an integer on the command line and in the C++ version of the program I was using...
7
1538
by: pinkfloydhomer | last post by:
When a function is given a pointer, it is tempting to do an assert on the pointer to see if it is not NULL. But even if it is not NULL, it could still be invalid or wrong. What we really want to...
28
1996
by: romy | last post by:
What's the easiest way to verify the user had entered a valid date ?
14
1509
by: tranky | last post by:
Hi, i'm italian...so...excuse me for my english. I've a little problem....in what manner i can check a textbox for know if it contain only character from A-Z (a-z), numbers (0-9), and underscore...
6
2021
by: Abubakar | last post by:
Hi, lets say I have a connected SOCKET s. At some point in time, I want to know if the "s" is still valid, that it is still connected. Is there any API that I can give me this information? And...
125
6469
by: jacob navia | last post by:
We hear very often in this discussion group that bounds checking, or safety tests are too expensive to be used in C. Several researchers of UCSD have published an interesting paper about this...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.