Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:18:16+00:00 2026-06-17T05:18:16+00:00

The textbox adds http:// to what ever the users enters (Ex. google.com turns to

  • 0

The textbox adds “http://” to what ever the users enters (Ex. “google.com” turns to “http://google.com”) before sending to the web browser, but if the user enters “http://” before their website you get an error.

this is my code:

     private void bargo_Click(object sender, RoutedEventArgs e)
    {
        Uri targetUri = new Uri(System.String.Format("http://{0}", bar.Text));
        web.Navigate(targetUri);

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:18:17+00:00Added an answer on June 17, 2026 at 5:18 am

    You can test whether bar.text already starts with http:// like this:

        private void bargo_Click(object sender, RoutedEventArgs e)
        {
            string url = bar.Text;
            if (!url.StartsWith("http://"))
            {
                url = "http://" + url;
            }
            web.Navigate(new Uri(url);
        }
    

    If your user enters “https://” or “ftp://” (or gopher://, irc://, ircs://, ftp://, news://, nntp://, worldwind://, telnet://, svn://, git://, mms:// and mailto:) this method will still add “http://” and fail.

    A better solution would be to pass a string into web.Navigate() instead of a uri. When you pass in a string, the WebBrowser control automatically adds http:// like a browser would.

        private void bargo_Click(object sender, RoutedEventArgs e)
        {
            web.Navigate(bar.Text);
        }
    

    EDIT: For Windows Phone 7

        private void bargo_Click(object sender, RoutedEventArgs e)
        {
            web.NavigateToString(bar.Text);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textbox user control and when I double click, it adds the
Scenario is simple: If you add a web browser in visual studio it adds
The code below adds a value into a textbox: $('#mainTxtWeight').val(textWeight); But what I want
What I have is a program that takes user's input from a textbox and
I have a textbox that I want to validate, but when I validate it
I wrote a website that adds information to a Mysql Database. But I want
I have here my Javascript code that adds dynamic textbox (row) my problem is
Hi I have a button (btnAdd) that adds the content of a textbox (txtName)
I have two forms. Clicking button on form1 opens form2 where user adds details
Based on a TextBox autocomplete functionality the user can select amongst a list of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.