My project is silverlight navighation project (IN-Browser) I want to navigate to an Url such as :
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(str
You cannot Navigate()
and still use POST. Navigate
is the equivalent of clicking a link or typing a URL in the address bar, which invokes the GET verb.
To use POST, you could instead use the Silverlight browser interop to programmatically create an HTML <form>
, set its action
attribute to the correct URL, set its target
attribute to "_blank"
, add some <input type="hidden">
fields, set their names and values and then submit()
the form.
// Get document and body
var doc = System.Windows.Browser.HtmlPage.Document;
var body = doc.Body;
// Create a <form> element and add it to the body
var newForm = doc.CreateElement("form");
newForm.SetAttribute("action", targetUrl);
newForm.SetAttribute("method", "post");
body.AppendChild(newForm);
// TODO: doc.CreateElement("input");
// TODO: SetAttribute("type", "hidden");
// TODO: SetAttribute("name", someName);
// TODO: SetAttribute("value", someValue);
// TODO: newForm.AppendChild()
newForm.Invoke("submit");