This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
developers:examples:c-sharp:basic [2016/10/26 08:12] 127.0.0.1 external edit |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== ADUCID - using C# and ASP.NET - Basic authentication example ====== | ||
- | |||
- | See all [[developers: | ||
- | |||
- | [[https:// | ||
- | |||
- | Simplified authentication request with personal factor verification written in C# | ||
- | |||
- | Import WSDL into your project in Visual Studio. | ||
- | |||
- | Create an instance of **AducidApiServiceClient **and make calls to ADUCID and get authentication result with a few rows of code: | ||
- | === I. Start page === | ||
- | |||
- | This page starts authentication request. As a parameter of verifyLF method we provide URL with final page where authentication is evaluated: | ||
- | |||
- | <code csharp> | ||
- | protected void Page_Load(object sender, EventArgs e) { | ||
- | var aducid = new AducidApiServiceClient(); | ||
- | string host = " | ||
- | var redirect = aducid.startAuthenticationSession(host + "/ | ||
- | Response.Redirect(redirect); | ||
- | } | ||
- | </ | ||
- | |||
- | === II. Result page === | ||
- | |||
- | On the result page we evaluate the authentication request using aducid.getResult | ||
- | |||
- | There are two basic results – authentication is OK or an error is thrown: | ||
- | |||
- | <code csharp> | ||
- | protected void Page_Load(object sender, EventArgs e) | ||
- | { | ||
- | var queryString = HttpContext.Current.Request.Url.Query; | ||
- | var query = HttpUtility.ParseQueryString(queryString); | ||
- | |||
- | var sb = new StringBuilder(); | ||
- | var aducid = new AducidApiServiceClient(); | ||
- | try | ||
- | { | ||
- | var result = aducid.getResult(query.Get(" | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | sb.Append("< | ||
- | |||
- | sb.Append("</ | ||
- | |||
- | } | ||
- | catch (Exception ee) | ||
- | { | ||
- | sb.Append(" | ||
- | } | ||
- | lResponse.Text = sb.ToString(); | ||
- | } | ||
- | </ | ||
- | |||