473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problem with AJAX login

Hi,

I have a very simple login page which I would like to use AJAX with.
User completes username and password fields, hits te button and is shown an 'in progress' image while the request is sent to the server - then the result is returned. I am almost there, but I have an annoyance.

The callback JS function is this:
function attemptLogin_Callback(response) {
if(response.value)
responseMessage.innerHTML = "Credentials accepted.<br/>Please wait...";
else
responseMessage.innerHTML = "Credentials not accepted.<br/>Please try again";

setTimeout('HideProcess();', 2000);

}

and the AjaxMethod is:
[AjaxPro.AjaxMethod()]
public bool attemptLogin(string username, string password)
{
return Security.Logon(username, password);
}

Security.Logon(string, string); is the method used to check the credentials, and is in the same namespace as the AjaxMethod.

Now, if I replace this Security.Logon(username,password) with "true" or "false", the response.value is correctly passed, but when I try to use this Logon method, response.value is always null. response.error is also null.
If I write the result from the Logon method to my page (Response.Write on Page_Load, for example), it displays correctly.

I've tried bringing all of the Logon code into the same class, as an experiement, and marking it as an AjaxMethod, but it still doesn't work.

So, can I not use a separate method to return my result? What am I doing wrong?

Thanks for your help.
Sep 14 '07 #1
1 944
Well, I knew it couldn't be that.
So I dug a little deeper, and realised that it was the session stuff that was causing it to fail, so all I had to do was change the AjaxMethod tag:
[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequire ment.ReadWrite)]

And all is well with the world again!
Sep 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: PJ6 | last post by:
I have AJAX-style calls that will require a user's login for permission checks. I might have been OK with the login ID rolled into a session variable, but now I'm faced with calling my AJAX...
1
by: zyon2k | last post by:
Hi, i'm new to ajax and javascript. i would like to login in a webapp and to keep the session until i logout. The webapp is developed in asp and return a cookie after login. I'm already...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
3
by: mudgilgaurav | last post by:
I am very keen to learn AJAX and want to use it in my website Can anyone give me a bunch of code abt ajax and as well as tell me the flow of code
1
by: quill | last post by:
Hi I am making a chatroom script and it appears that the problem seems to be that my setTimeout's are conflicting. The logic is as follows: Run a login check every x seconds Run a trigger...
1
by: jianxin9 | last post by:
Hi, I have an ajax powered tabs box that has a javascript drop-down search menu in the first tab. When I click on another tab, and go back to the first tab I have to refresh the page to get the...
5
by: Mike | last post by:
Hello, I have a Login page that checks a Db for a Un and Pw using ajax. If the Login is incorrect, they just get a embedded message. If it is correct, I want to redirect COMPLETLY. Whats...
3
by: krg | last post by:
Hi, I started writing this blog some time back and it would be great if I could get an audience here and even better if we could have a conversation about developments possible on the techniques I...
2
by: Gufo Rosso | last post by:
example dragable obj start at 0,0 user move obj to 100,100 library send ajay request 100,100 other ex form user send a form to ajax
2
by: jmoran | last post by:
Hello there. I've been thinking if some AJAX-authentication system is secure since Javascript is downloaded into the client machine... Thanks in advance for your help.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.