Monday, March 26, 2012

integration with asp.net services

Is there any documentation or examples online for creating atlas
applications that use the asp.net services?

Wally

--
Wallace B. McClure
"The Harder I Work, the Luckier I Get."
Listen to "The ASP.NET Podcast" at http://www.aspnetpodcast.com/
Database Award: http://url123.com/vc3er
Microsoft MVP - Visual Developer ASP/ASP.NET
AspInsider
"AJAX for ASP.NET" Coming Soon!
ADO.NET Book: http://url123.com/vc2bu
865-693-3004
118 Durwood Rd.
Knoxville, TN 37922
http://www.scalabledevelopment.com/
Blog: http://weblogs.asp.net/wallym/

Have you looked at theservices quickstarts? They have examples on doing this.

David


I have not seen any examples on integrating with things like membership,
authentication, and authorization. Do you have a URL?

Wally

wrote in message news:1196178@.66.129.67.202...
> Have you looked at the services quickstarts? They have examples on doing
> this.
>
> David
>
I have not seen any examples on integrating with things like membership,
authentication, and authorization. Do you have a URL?

Wally

wrote in message news:1196178@.66.129.67.202...
> Have you looked at the services quickstarts? They have examples on doing
> this.
>
> David
>
Sorry, I misunderstood your reference to "asp.net services" as meaning calling asmx asp.net web services from script. Let me check whether there is a sample relating to auth and membership.

The current integration with Membership and Forms authentication is limited to two methods on Web.Services.AuthenticationSerivce:

login

validateUser

The first method accepts a username, password and clientside event hookups for completion, errors and timeouts. Back on the server it validates the credentials with thedefault Membership provider. Assuming the call to ValidateUser succeeds, the "login" method returns a forms authentication cookie by calling FormsAuthentication.SetCookie(). When the call to ValidateUser succeeds, the result from "login" is true - failed credentials result in a "false" return value and no cookie.

The code for this looks something like:

function OnSubmitLogin() {
//Use the built in Atlas authentication service to make a call to the server.
//This call will verify credentials, and if the credentials are good, the server will
//issue a forms authentication cookie.
Web.Services.AuthenticationService.login(username.value, password.value, OnLoginComplete);
return false;
}

//The asynchronous completion event where you process the result of calling the server
function OnLoginComplete(result) {
password.value = '';

//On success there will be a forms authentication cookie in the browser.
if (result) {
username.value = '';
textLoggedIn.style.visibility = "visible";
textNotLoggedIn.style.visibility = "hidden";

buttonLoginLogout.innerText = "Click me to logout!";
buttonLoginLogout.onclick = OnSubmitLogout;
}
else {
textLoggedIn.style.visibility = "hidden";
textNotLoggedIn.style.visibility = "visible";
}
}

The "validateUser" works similarly to "login", but no forms auth cookie is set.


Awesome info. I had been scanning through the Atlas.js file and I was
trying to understand the difference between login and validateUser. That
info really helps.

Wally

wrote in message news:1197028@.66.129.67.202...
> The current integration with Membership and Forms authentication is
> limited to two methods on Web.Services.AuthenticationSerivce:
>
> login
>
> validateUser
>
> The first method accepts a username, password and clientside event hookups
> for completion, errors and timeouts. Back on the server it validates the
> credentials with the default Membership provider. Assuming the call to
> ValidateUser succeeds, the "login" method returns a forms authentication
> cookie by calling FormsAuthentication.SetCookie(). When the call to
> ValidateUser succeeds, the result from "login" is true - failed
> credentials result in a "false" return value and no cookie.
>
> The code for this looks something like:
>
> function OnSubmitLogin() {
> //Use the built in Atlas authentication service to make a call to the
> server.
> //This call will verify credentials, and if the credentials are good,
> the server will
> //issue a forms authentication cookie.
> Web.Services.AuthenticationService.login(username.value,
> password.value, OnLoginComplete);
> return false;
> }
>
> //The asynchronous completion event where you process the result of
> calling the server
> function OnLoginComplete(result) {
> password.value = '';
>
> //On success there will be a forms authentication cookie in the
> browser.
> if (result) {
> username.value = '';
> textLoggedIn.style.visibility = "visible";
> textNotLoggedIn.style.visibility = "hidden";
>
> buttonLoginLogout.innerText = "Click me to logout!";
> buttonLoginLogout.onclick = OnSubmitLogout;
> }
> else {
> textLoggedIn.style.visibility = "hidden";
> textNotLoggedIn.style.visibility = "visible";
> }
> }
>
> The "validateUser" works similarly to "login", but no forms auth cookie is
> set.
>
No problem. I had hoped that there was something I was missing in the
quickstarts. :-)

Wally

wrote in message news:1196977@.66.129.67.202...
> Sorry, I misunderstood your reference to "asp.net services" as meaning
> calling asmx asp.net web services from script. Let me check whether there
> is a sample relating to auth and membership.
>

No comments:

Post a Comment