Does the Url exist in the web?

Does the Url address exist in the web?

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 2893 Views - Last Post: 18 March 2010 - 02:34 PM Rate Topic: -----

#1 espirator   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-March 10

Does the Url exist in the web?

Posted 17 March 2010 - 02:19 PM

Hi everyone;

I'd like to control textbox in C#.NET

How can i control that the URL or the text we entered to textbox exist in the web or not?

What should i do?

Looking for your suggestions.

Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: Does the Url exist in the web?

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6258
  • View blog
  • Posts: 24,026
  • Joined: 23-August 08

Re: Does the Url exist in the web?

Posted 17 March 2010 - 02:28 PM

Choose the event you wish to handle from the textbox and use the Dns class to validate the entered URL.

This post has been edited by JackOfAllTrades: 17 March 2010 - 04:22 PM
Reason for edit:: Fixed bad link

Was This Post Helpful? 0
  • +
  • -

#3 espirator   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-March 10

Re: Does the Url exist in the web?

Posted 17 March 2010 - 02:37 PM

What do you mean Dns Class?
I don't understand a thing from you linked to?
Was This Post Helpful? 0
  • +
  • -

#4 Gonzilla   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 23
  • Joined: 16-March 10

Re: Does the Url exist in the web?

Posted 17 March 2010 - 02:44 PM

He posted a link from a another (wrong) thread, ignore it :) Here you find more information.

This post has been edited by Gonzilla: 17 March 2010 - 02:44 PM

Was This Post Helpful? 0
  • +
  • -

#5 espirator   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-March 10

Re: Does the Url exist in the web?

Posted 17 March 2010 - 03:15 PM

Gonzilla thank you for your interest. ;)

The link you gave explains something but doesn't explain how to do. :dontgetit:

How to use these codes??

public static class Dns
IPHostEntry hostInfo = Dns.GetHostByName("www.contoso.com");

Please :helpsmilie: me.
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1660
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Does the Url exist in the web?

Posted 17 March 2010 - 03:17 PM

Did you even try anything? Or did you just open that link, look at it for a second and think "I dont understand" then come back here looking for someone to write it for you?
Was This Post Helpful? 0
  • +
  • -

#7 espirator   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-March 10

Re: Does the Url exist in the web?

Posted 17 March 2010 - 03:22 PM

Of course i tried. But i dont understand how to use it?

i have a textbox and a button. Button will control the textbox.

For instance: when we click the button messagebox will show the url is exist or not.

I think u understand me. But im not good at c#. Plz help me. Thanks
Was This Post Helpful? 0
  • +
  • -

#8 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6258
  • View blog
  • Posts: 24,026
  • Joined: 23-August 08

Re: Does the Url exist in the web?

Posted 17 March 2010 - 04:21 PM

I'm sorry about the bad link...too many things going at once.
Was This Post Helpful? 0
  • +
  • -

#9 MentalFloss   User is offline

  • .
  • member icon

Reputation: 619
  • View blog
  • Posts: 1,590
  • Joined: 02-September 09

Re: Does the Url exist in the web?

Posted 17 March 2010 - 07:43 PM

Quote

Of course i tried. But i dont understand how to use it?

i have a textbox and a button. Button will control the textbox.

For instance: when we click the button messagebox will show the url is exist or not.

I think u understand me. But im not good at c#. Plz help me. Thanks


Maybe you should post this in Post a Job forum so you can pay someone to do this work for you.
Was This Post Helpful? 0
  • +
  • -

#10 espirator   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 07-March 10

Re: Does the Url exist in the web?

Posted 18 March 2010 - 05:52 AM

Thank you for suggestion. But i don't need a suggestion. i need a solution
Was This Post Helpful? -1
  • +
  • -

#11 beju0506   User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 78
  • Joined: 23-February 08

Re: Does the Url exist in the web?

Posted 18 March 2010 - 06:17 AM

Espirator,

In this forum, people generally don't give you exact code to answer your question; you're expected to take the suggestions people give and try to develop your own solution... that said, this might help you out some:

http://www.vcskicks....eck-website.php

It's a different solution (not using the DNS class) and checks to see if the entire URL is valid, not just the domain name. Next time, you should try and really thoroughly Google what you're looking for... I found this page on Google in the first three links.

Here's another:

http://carso-owen.bl...accessible.html

Hopefully this will put you in the right direction.

-Justin
Was This Post Helpful? 2
  • +
  • -

#12 TwistedMind   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-March 10

Re: Does the Url exist in the web?

Posted 18 March 2010 - 11:05 AM

View Postbeju0506, on 18 March 2010 - 05:17 AM, said:

Espirator,

In this forum, people generally don't give you exact code to answer your question; you're expected to take the suggestions people give and try to develop your own solution... that said, this might help you out some:

http://www.vcskicks....eck-website.php

It's a different solution (not using the DNS class) and checks to see if the entire URL is valid, not just the domain name. Next time, you should try and really thoroughly Google what you're looking for... I found this page on Google in the first three links.

Here's another:

http://carso-owen.bl...accessible.html

Hopefully this will put you in the right direction.

-Justin


I can understand using a regex for this but if you want to see if the url is an actual live website then you are looking at writing a bit more code to accomplish this. I say a bit, maybe 20 to 30 lines.
Was This Post Helpful? 0
  • +
  • -

#13 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1660
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Does the Url exist in the web?

Posted 18 March 2010 - 11:08 AM

View Postespirator, on 18 March 2010 - 03:52 AM, said:

Thank you for suggestion. But i don't need a suggestion. i need a solution


You're not going to get this written for you. We're here to help not to write your code or give you an entire solution to whatever issue you're having trouble with
Was This Post Helpful? 0
  • +
  • -

#14 TwistedMind   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-March 10

Re: Does the Url exist in the web?

Posted 18 March 2010 - 11:13 AM

View PostPsychoCoder, on 18 March 2010 - 10:08 AM, said:

View Postespirator, on 18 March 2010 - 03:52 AM, said:

Thank you for suggestion. But i don't need a suggestion. i need a solution


You're not going to get this written for you. We're here to help not to write your code or give you an entire solution to whatever issue you're having trouble with


This dude needs to go look up how to use the WebRequest and WebResponse pop a try catch around it and move on. LOL
Was This Post Helpful? 0
  • +
  • -

#15 Mirge   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 18-March 10

Re: Does the Url exist in the web?

Posted 18 March 2010 - 11:13 AM

View PostTwistedMind, on 18 March 2010 - 10:05 AM, said:

View Postbeju0506, on 18 March 2010 - 05:17 AM, said:

Espirator,

In this forum, people generally don't give you exact code to answer your question; you're expected to take the suggestions people give and try to develop your own solution... that said, this might help you out some:

http://www.vcskicks....eck-website.php

It's a different solution (not using the DNS class) and checks to see if the entire URL is valid, not just the domain name. Next time, you should try and really thoroughly Google what you're looking for... I found this page on Google in the first three links.

Here's another:

http://carso-owen.bl...accessible.html

Hopefully this will put you in the right direction.

-Justin


I can understand using a regex for this but if you want to see if the url is an actual live website then you are looking at writing a bit more code to accomplish this. I say a bit, maybe 20 to 30 lines.


Not sure where anybody mentioned using a regular expression? Maybe I missed it. The 2 links I saw that you quoted both connect to the URL and check the response. :)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2