Avatar of databoks
databoksFlag for Denmark asked on

Navigation in Silverlight4


I have a Login.aspx site. If the Login is sucessfull the user will be redirected to a aspx site which contains silverlight.


I want to pass on username to MainPage.xaml contructor. The MainPage is called when the redirection from the login.aspx site.


I cannot use Response.Redirect("page");
becuase i need to pass username also this page, which will be passed to the mainpage.xaml page.

If you have a better solution please provide.

Thanks.
.NET ProgrammingC#ASP.NETWeb Languages and Standards

Avatar of undefined
Last Comment
databoks

8/22/2022 - Mon
DarkoLord

Hi,

there are a couple of ways of doing this.

If you really just want to pass the username (however note that the user could modify this as the Silverlight control is running on the client side), you could:

- Pass the username via the query string and read it directly with:

System.Windows.Browser.HtmlPage.Document.QueryString["paramName"]

Open in new window


- Pass the username to the aspx page containing the Silverlight control (for example via Session) and set the InitParameters of the Silverlight control in the aspx page codebehind, in this format:

SilverlightControl.InitParameters = "Username=Test";

Open in new window


You can then access it in the SL control like this:

private void Application_Startup(object sender, StartupEventArgs e)
        {
            string username = e.InitParams["Username"];
        }

Open in new window

ASKER
databoks

Thank you.

I wll try this. :)

ASKER
databoks

How would you recommend a Login in a Secure manner?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
DarkoLord

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
databoks

Thank you.