Click here to Skip to main content
15,910,009 members
Home / Discussions / C#
   

C#

 
Questionwhat's your number? Pin
Sled Dog27-Oct-04 11:54
Sled Dog27-Oct-04 11:54 
QuestionProtection level ? Pin
wtdoor196527-Oct-04 10:13
wtdoor196527-Oct-04 10:13 
AnswerRe: Protection level ? Pin
Christian Graus27-Oct-04 10:16
protectorChristian Graus27-Oct-04 10:16 
AnswerRe: Protection level ? Pin
sreejith ss nair27-Oct-04 18:19
sreejith ss nair27-Oct-04 18:19 
GeneralRe: Protection level ? Pin
Heath Stewart27-Oct-04 21:02
protectorHeath Stewart27-Oct-04 21:02 
GeneralGet the IP from HttpWebRequest Pin
Justin Garrick27-Oct-04 10:09
Justin Garrick27-Oct-04 10:09 
GeneralRe: Get the IP from HttpWebRequest Pin
Justin Garrick27-Oct-04 15:43
Justin Garrick27-Oct-04 15:43 
GeneralRe: Get the IP from HttpWebRequest Pin
Nick Parker27-Oct-04 17:12
protectorNick Parker27-Oct-04 17:12 
A quick work around will be a way to format the input from the user, in your case, the address, into an appropriate Uri format so your class can be created. I have written up a simple formatting method that will allow you to accept different formats as you stated above (i.e., www.google.com and google.com) and create the appropriate Uri class from it. Try the following:

private Uri FormatUri(string url)
{
    Uri uri = null;
    if(!url.ToLower().StartsWith("http://"))
    {
        uri = new Uri("http://" + url);
    }
    else
        uri = new Uri(url);
    return uri;
}

So you can use this as follows:

private void button1_Click(object sender, System.EventArgs e)
{
    Uri uri = FormatUri(this.textBox1.Text);
    MessageBox.Show(uri.AbsoluteUri);
}

HTH

- Nick Parker
My Blog | My Articles

GeneralRe: Get the IP from HttpWebRequest Pin
Heath Stewart27-Oct-04 21:07
protectorHeath Stewart27-Oct-04 21:07 
QuestionC# on Linux...?!? Pin
QzRz27-Oct-04 7:24
QzRz27-Oct-04 7:24 
AnswerRe: C# on Linux...?!? Pin
Alex Korchemniy27-Oct-04 7:39
Alex Korchemniy27-Oct-04 7:39 
GeneralRe: C# on Linux...?!? Pin
QzRz27-Oct-04 7:43
QzRz27-Oct-04 7:43 
Generalupdating using a dataset. Pin
steve_rm27-Oct-04 7:13
steve_rm27-Oct-04 7:13 
GeneralRe: updating using a dataset. Pin
Hugo Migneron27-Oct-04 7:49
Hugo Migneron27-Oct-04 7:49 
GeneralRe: updating using a dataset. Pin
steve_rm27-Oct-04 14:12
steve_rm27-Oct-04 14:12 
GeneralRe: updating using a dataset. Pin
Hugo Migneron28-Oct-04 3:16
Hugo Migneron28-Oct-04 3:16 
GeneralSplash Screen Pin
mathon27-Oct-04 6:53
mathon27-Oct-04 6:53 
GeneralRe: Splash Screen Pin
Colin Angus Mackay27-Oct-04 7:20
Colin Angus Mackay27-Oct-04 7:20 
GeneralRe: Splash Screen Pin
Dave Kreskowiak27-Oct-04 11:30
mveDave Kreskowiak27-Oct-04 11:30 
GeneralManipulating cmd.exe on another pc Pin
uwgrimlock27-Oct-04 6:48
uwgrimlock27-Oct-04 6:48 
GeneralRe: Manipulating cmd.exe on another pc Pin
Nick Parker27-Oct-04 8:07
protectorNick Parker27-Oct-04 8:07 
GeneralTAPI Pin
Mridang Agarwalla27-Oct-04 5:26
Mridang Agarwalla27-Oct-04 5:26 
GeneralRe: TAPI Pin
Nick Parker27-Oct-04 8:03
protectorNick Parker27-Oct-04 8:03 
GeneralRe: TAPI Pin
Michael P Butler27-Oct-04 23:25
Michael P Butler27-Oct-04 23:25 
GeneralC# p/invoke the sendmessage(Hwnd,....) Pin
ting66827-Oct-04 5:16
ting66827-Oct-04 5:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.