Invoke htm file with query string in browser from C# issue

We are trying to open a htm file in a firefox browser from a C# console app. The htm file is supposed to take the name of a video file as a query string parameter so that the file can be played back in the browser. Now both the video file and the htm are local to the C# console app.

We have used the following code:

var playerFile = Path.Combine(folderPath, "player.htm");
var medianame = Path.GetFileNameWithoutExtension(mediaFilename) + ".theora.ogv";
var url = string.Format("{0}?name={1}", playerFile, medianame);
System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", url);

The url should be of the form

file:///D:/Projects/Tester/bin/Debug/Content/player.htm?name=Promo[39171369900].theora.ogv

but when the firefox browser opens up, it has the following in the address bar:

file:///D:/Projects/Tester/bin/Debug/Content/player.htm%3Fname=Promo%5B39171369900%5D.theora.ogv

Since the ? and [ ] are getting url encoded when opening up in the browser, it cannot play the video. If the %3F and %5B %5D are replaced, the file plays properly.

Can anybody provide any help.

Answers


Please use the Server.UrlDecode method to decode your url

Or try using the System.Uri.UnescapeDataString


To answer my own question, I finally solved the issue using a batch file to open the htm file and invoked the batch from the C# app, passing the filename as argument to the batch. Thanks for all your help.


Need Your Help

How to properly toggle UITableViewCell's accesoryType on cell selection/deselection?

ios uitableview

I'm trying to toggle accesoryType when a table cell is selected/deselected... the behavior should be: tap -> set accessoryType to UITableViewCellAccessoryCheckmark -> tap the cell again -> rollback...

emma not generating reports but cobertura does?

maven-2 cobertura emma

basic reason to put the comparison question between these 2 is I am able to generate the reports in site directory(for cobertura) after putting the following plug in information in build section of...