Helloooo.
I need a solution for this.
Visual Studio says that the character '?' is illegal in a path.
I'm using the '?' in a URL.
Is there anyway to replace the '?' but still keep the URL working.
I've tried using "string.replace" but that didn't work.
Any ideas?
Thanks.
This is the code which uses the URL.
Code:public void StartAll() { int i = 0; foreach (var link in Links) { try { var uri = new Uri(link); } catch (Exception exception) { OnError(i, "Error: Job ID(" + i + ") " + exception.Message); i++; continue; } var backgroundWorker = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; backgroundWorker.DoWork += (backgroundWorker_DoWork); backgroundWorker.ProgressChanged += (backgroundWorker_ProgressChanged); backgroundWorker.RunWorkerCompleted += (backgroundWorker_RunWorkerCompleted); var downloadParam = new QDownloadParam() { ID = i, FileDirectory = FileDirectory, Link = link, Password = Password, Username = Username, Worker = backgroundWorker }; Jobs.Add(downloadParam); OnChanged(i, "Job ID(" + i + ") Added."); backgroundWorker.RunWorkerAsync(downloadParam); i++; } OnlineJobs = Jobs.Count; }
Try using strings instead of vars.
I tried like that and no exceptions.
var uri = new Uri("http://forum.codecall.net/newreply.php?do=newreply&noquote=1&p=235898");
Uri allows "?" only in right places. Show exact link that doesn't work.
BTW i don't see usage of your uri variable (only assignment).
This seems to be working:
var uri = new Uri("http://forum.codecall.net/newreply.php?do=newreply&noquote=1&p=235898");
What is the exact error that you receive?
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks