locked
dont want to go back to start page, when i press f5 in my browser RRS feed

  • Question

  • hi to all SILVERLIGHT team...

    i am new to silverlight, please help me out in knowing that how would i manage my silveright application state...

    i have a login page... when i logged in to it and reach homepage and suppose i want to move from homepage to another page... and if i press's f5 in my second page... i go back to login page... i only want to go back to login page when i press's logout... not by pressing f5...

    thanks in advance...

    Thursday, August 11, 2011 8:20 PM

Answers

All replies

  • If you press F5, the Application_Exit event will be fired and it will take you the control which set as RootVisual.

    I think you cant.

    Friday, August 12, 2011 1:37 AM
  • As Syed says from silverlight perspective we can't achive ur goal. But we can do this with JavaScript
    <script language="JavaScript"> 
      window.onbeforeunload = confirmExit;
      function confirmExit()
      {
        return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?";
      }
    </script>
    This will aware the user. After this if he clicks ok then he will move to the LogIn page (RootVisual page). On cancel he will remain in the same page.
    Friday, August 12, 2011 2:38 AM
  • thanks Syed N Rakun for ur reply...

    SYED : if this thing cant be achieved in siverlight then i wonder how can people make aunthentication and authorization application in silverlight... how you people maintain sessions ???

    RAKUN : thanks Rakun for your suggestion... i really admire that... are you people do the same thing for your applications... means user need not to click on logout button... all he need to do is to press f5... he'l automatically be logged out... is that so... ???

    kindly help me out, my boss wont agree with me if i say to him that there's no proper session management techniques in silverlight...

    Friday, August 12, 2011 8:53 AM
  • If you use the navigation framework then pressing f5 will keep you on the existing page.  More information on the navigation framework can be found here - http://msdn.microsoft.com/en-us/library/cc838245(v=vs.95).aspx

    What are you using for your authentication?  If your using ASP.Net membership you can choose to persist the session and it will keep them logged in.

    Sunday, August 14, 2011 5:26 PM
  • thanks butcher for your reply...

    i am really so much confused on that and have read so many articles on SL authehtication and session management... but all in vain :(

    i am using navigation framework... and i have two project in my solution named "student" and "student.web"

    i entered login credentials from a silverlight page named 'login.xaml" and then by using RIA services, i pass my login credential and then after authentication, i goto user homepage... but when user refresh his page then he is transferred back to login.xaml...

    please provide me some sample code in this regard... it would be so much helpful to me...

    Monday, August 15, 2011 8:58 PM
  • Hi,

    For authentication, please use WCF authentication service:

    http://msdn.microsoft.com/en-us/library/ee942451(v=VS.91).aspx

    Monday, August 15, 2011 10:05 PM