using Microsoft.Live; using ???.async; namespace OneDriveSignin { public partial class _Default : Page { protected void Button1_Click(object sender, EventArgs e) { Loginvalue(); } private async void Loginvalue() { LiveAuthClient authClient = new LiveAuthClient("http://localhost/myapp"); LiveLoginResult loginResult = await authClient.InitializeAsync(new List<string>() { "wl-signin" }); this.TextBox1.Text = loginResult.Session.AuthenticationToken; } } }
An exception of type 'System.InvalidOperationException' occurred in System.Web.dll but was not handled in user code Additional information: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)