Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically login to another page from a Silverlight application?

I have written a Silverlight page that acts as an Account Registration facility for an existing web application. So it gathers the users details then submits them to the server via a WCF RIA Service where the account is created in the database.

Basically I want to automatically log the user into the application when the service returns that the registration has been successful but I am unsure how to do this.

My current thought is that if I can POST the username and password to the existing login page then everything would be fine. However, while I can find numerous examples of how to do a HTTP post from Silverlight, they mostly seem to assume that I want to display the response within the existing Silverlight application - I don't, I want the Silverlight app to go away and I want the logged-in application to display, as if I had hit the login button on the login page.

Something along the lines of

HtmlPage.Window.Navigate(new Uri("http://mysite.com/Login.aspx", UriKind.Absolute));

except with posting capability.

I do not want to pass the username and password in the querystring.

Anyone know how I can do this? Or if this not the right approach can someone point me in the right direction.

like image 451
Adam Jones Avatar asked Dec 14 '25 14:12

Adam Jones


1 Answers

Add a form (it could be hidden) to the HTML page that is hosting the Silverlight content. Then from within Silverlight, use the DOM to programmatically submit the form.

like image 101
Josh Avatar answered Dec 17 '25 07:12

Josh