Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Building a System.Uri with a query string

Building a System.Uri with a query string

Scheduled Pinned Locked Moved Mobile
csharpquestiondatabasevisual-studiocom
2 Posts 1 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Spacix One
    wrote on last edited by
    #1

    please note: Yes I already posted this in the C# forum ( http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2604582[^] ), but at the suggestion of others said I might have better luck here. I give up, this seems impossible without the UriBuilder class... Well since .NET 1.1 when they made Uri(string, bool) obsolete... So here is my question: How do you build a System.Uri object in .NET compact framework that points to a "file://" scheme with passed query information? I've tried every valid (not obsolete) constructor for System.Uri meaning: * Uri(string) * Uri(string, UriKind) * Uri(base, string) * Uri(Uri, Uri) It didn't matter which I use because they don't have any affect on the outcome... Every constructor will escape the ? to hex as %3F which is not valid to use with query information!!! I can do this fine with strings but if I pass a string to the WebBrowser control it'll convert the string to a Uri object and have the problem again. So I need to build the correct Uri object and pass it to the WebBrowser control. MSDN says the following lie:

    http://msdn.microsoft.com/en-us/library/system.uri(VS.80).aspx[^] wrote:

    The Uri constructors do not escape URI strings if the string is a well-formed URI including a scheme identifier.

    Proven by this example:(start a new smart device application and add this code to the form1.cs file)

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace DeviceApplication1
    {
    public partial class Form1 : Form
    {
    public int demoValue = 4;
    public Form1()
    {
    InitializeComponent();
    this.Load += new EventHandler(this.Form1_Load);
    }

        void Form1\_Load(object sender, EventArgs e) 
        { 
            Uri htmlFile = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), UriKind.Absolute); 
            MessageBox.Show(
    
    S 1 Reply Last reply
    0
    • S Spacix One

      please note: Yes I already posted this in the C# forum ( http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2604582[^] ), but at the suggestion of others said I might have better luck here. I give up, this seems impossible without the UriBuilder class... Well since .NET 1.1 when they made Uri(string, bool) obsolete... So here is my question: How do you build a System.Uri object in .NET compact framework that points to a "file://" scheme with passed query information? I've tried every valid (not obsolete) constructor for System.Uri meaning: * Uri(string) * Uri(string, UriKind) * Uri(base, string) * Uri(Uri, Uri) It didn't matter which I use because they don't have any affect on the outcome... Every constructor will escape the ? to hex as %3F which is not valid to use with query information!!! I can do this fine with strings but if I pass a string to the WebBrowser control it'll convert the string to a Uri object and have the problem again. So I need to build the correct Uri object and pass it to the WebBrowser control. MSDN says the following lie:

      http://msdn.microsoft.com/en-us/library/system.uri(VS.80).aspx[^] wrote:

      The Uri constructors do not escape URI strings if the string is a well-formed URI including a scheme identifier.

      Proven by this example:(start a new smart device application and add this code to the form1.cs file)

      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;

      namespace DeviceApplication1
      {
      public partial class Form1 : Form
      {
      public int demoValue = 4;
      public Form1()
      {
      InitializeComponent();
      this.Load += new EventHandler(this.Form1_Load);
      }

          void Form1\_Load(object sender, EventArgs e) 
          { 
              Uri htmlFile = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), UriKind.Absolute); 
              MessageBox.Show(
      
      S Offline
      S Offline
      Spacix One
      wrote on last edited by
      #2

      After further testing this has been reported as a bug to the Visual Studio and .NET team via MS Connect: Bug ID 352533


      -Spacix All your skynet questions[^] belong to solved


      I dislike the black-and-white voting system on questions/answers. X|


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups