(This is a continuation from the previous post: Lab2 “Forge API Intro”)
The good news is that we have written the functions to make the Forge web services REST calls in a way that we can simply reuse them. In the sample project, we put the common Forge REST calls under Forge folder. You can simply copy the folder to your web application if you have followed the labs 1 and 2.
Instead of Win Form, we use Web Form when we choose a project in Microsoft Visual Studio (MSVS). For this exercise, a simple single web page will be enough. MSVS ASP.NET development environment provides you a set of tools that is analogous to win forms tools. If you have been programming a Windows application using Visual Studio, it will look familiar to you.
Difference is, of course, the UI is a web page. A web page in ASP.NET has an extension “aspx”. ASP.NET tools starts with “asp:” in a web form. A code behind an aspx page has an extension “aspx.cs”. In the corresponding code, most of the implementation is analogous to the Win Forms. Only difference is that to save values between different REST calls, we use HttpContext.Current.Session object instead of using a member variable, e.g.,
// Save authToken for this session
Session[“authToken”] = authToken;
// Retrieve authToken for this session
string accessToken = Session[“authToken”] as string;
The image below shows an example of how an application might look.
You can get the source code for Lab 3 from here: Lab3