How can I accomplish this in JqueryMobile
I have a an aspx file which takes userName a开发者_运维百科nd password . Using the web service call in .ajax , I am athenticating the user. Now I would like the user to be sent to a different page , example auth.aspx. How can I accmplish this ...?? I also want to make sure auth.aspx file is not accessed without login. I know to acomplish this with plain asp.net technologies. But can't figure out how to do the same using JQueryMobile. Can anyone help me with this ...???
Thanks in advance...!!!!
Assuming you're working on an ASP.NET site, your solution I believe lies on the server.
First you need to decorate the authentication webservice method with this attribute:
[WebMethod(EnableSession=true)]
public result Authenticate()
{
}
Now, when you successfully validate the user, set a Session variable to logged in:
Session["IsLogged"] = true;
You get the webservice result in the browser and it's successful, redirect using window.location = "auth.aspx";
On the auth.aspx page, just check if the session variable exists and is set to true. If it's not there or not true, then Response.Redirect back to the login page...
EDITS
Notifying the user is very straight forward... The methodology for this has varying levels of complexity, to start simple: put a span html tag on your login page, add an id attribute to the html tag
<span id="login_success"></span>
Then use jQuery to update the text in that span after you return from the authentication webservice.
$('#login_success').text('You have successfully logged in!');
精彩评论