Click here to Skip to main content
15,893,486 members
Home / Discussions / C#
   

C#

 
GeneralRe: Tele-type screen saver Pin
Elvis_Pretzelator26-Jun-08 5:39
Elvis_Pretzelator26-Jun-08 5:39 
QuestionC# Thread termination issue Pin
Merlock219-Jun-08 8:39
Merlock219-Jun-08 8:39 
QuestionHelp: I'm new to C#: I want to make a global function Pin
TheFoZ19-Jun-08 8:27
TheFoZ19-Jun-08 8:27 
AnswerRe: Help: I'm new to C#: I want to make a global function Pin
Judah Gabriel Himango19-Jun-08 8:56
sponsorJudah Gabriel Himango19-Jun-08 8:56 
GeneralRe: Help: I'm new to C#: I want to make a global function Pin
TheFoZ19-Jun-08 9:03
TheFoZ19-Jun-08 9:03 
GeneralRe: Help: I'm new to C#: I want to make a global function Pin
Guffa19-Jun-08 11:20
Guffa19-Jun-08 11:20 
QuestionRadioButtonList Pin
john3419-Jun-08 7:59
john3419-Jun-08 7:59 
QuestionBuilding a System.Uri with a query string Pin
Spacix One19-Jun-08 7:40
Spacix One19-Jun-08 7:40 
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:
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("htmlFile.AbsoluteUri=\r\n" + htmlFile.AbsoluteUri); //show how the path is converted correctly into a uri string with a correct scheme 
            string properFormated = string.Format("{0}/DeviceApplication1/test.html?test={1}", htmlFile.AbsoluteUri, this.demoValue); 
            MessageBox.Show("properFormated=\r\n" + properFormated); //show the string is properly formated and escaped correctly! 
            Uri fileWithQuery = new Uri(properFormated); 
            MessageBox.Show("fileWithQuery.PathAndQuery=\r\n" + fileWithQuery.PathAndQuery); //show the error in the Uri not accepting the query content 
        } 
    } 
}


View your results and see my problem Frown | :( any suggestions? I'm desprate at the moment (this has been bothering me since April!)


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

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

AnswerRe: Building a System.Uri with a query string Pin
Judah Gabriel Himango19-Jun-08 8:24
sponsorJudah Gabriel Himango19-Jun-08 8:24 
GeneralRe: Building a System.Uri with a query string Pin
Spacix One19-Jun-08 9:06
Spacix One19-Jun-08 9:06 
GeneralRe: Building a System.Uri with a query string Pin
Judah Gabriel Himango19-Jun-08 11:05
sponsorJudah Gabriel Himango19-Jun-08 11:05 
GeneralRe: Building a System.Uri with a query string Pin
Spacix One19-Jun-08 13:00
Spacix One19-Jun-08 13:00 
QuestionOver ride GetReaderFromMessage method Pin
Toms Edison19-Jun-08 7:23
Toms Edison19-Jun-08 7:23 
QuestionSystem.Windows.Forms.Panel Pin
zvit19-Jun-08 6:33
zvit19-Jun-08 6:33 
AnswerRe: System.Windows.Forms.Panel Pin
Spacix One19-Jun-08 7:22
Spacix One19-Jun-08 7:22 
QuestionHow can we find the our system connected to the WEB ? Pin
Mohammad Dayyan19-Jun-08 5:02
Mohammad Dayyan19-Jun-08 5:02 
AnswerRe: How can we find the our system connected to the WEB ? Pin
Ashfield19-Jun-08 5:22
Ashfield19-Jun-08 5:22 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Mohammad Dayyan19-Jun-08 5:30
Mohammad Dayyan19-Jun-08 5:30 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Ashfield19-Jun-08 6:00
Ashfield19-Jun-08 6:00 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Gareth H19-Jun-08 6:29
Gareth H19-Jun-08 6:29 
AnswerRe: How can we find the our system connected to the WEB ? Pin
Zoltan Balazs19-Jun-08 6:09
Zoltan Balazs19-Jun-08 6:09 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Mohammad Dayyan19-Jun-08 6:38
Mohammad Dayyan19-Jun-08 6:38 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Zoltan Balazs19-Jun-08 6:57
Zoltan Balazs19-Jun-08 6:57 
GeneralRe: How can we find the our system connected to the WEB ? Pin
Mohammad Dayyan19-Jun-08 11:18
Mohammad Dayyan19-Jun-08 11:18 
QuestionProblems with FreeImage Pin
Chrisfrmatl19-Jun-08 4:54
Chrisfrmatl19-Jun-08 4:54 

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.