Welcome to AppCenter

Web4 Class – Help Document

This helper class is used in ASP.NET Core web apps to get paths, URLs, query values, and client details.

Purpose
  • Get application physical paths (Config, Temp, Log, AppData)
  • Get website base URL and full page URL
  • Read query string values
  • Get client IP address
How to Use in ASP.NET Core
public class HomeController : Controller
{
    public IActionResult Index()
    {
        var web = new Web4(HttpContext);

        string appUrl = web.GetAppUrl();
        string pageUrl = web.GetPageUrl();
        string clientIp = web.GetClientIP();
        string tempFolder = web.TempPath;

        return Content($"App URL: {appUrl}
Page URL: {pageUrl}
IP: {clientIp}");
    }
}
Constructor

The constructor auto-creates required folders inside the app root:

  • Config
  • Temp
  • Log
  • AppData
Available Methods
  • GetAppUrl() – Returns base site URL
  • GetPageUrl() – Returns current full page URL
  • GetQuery(key) – Get query string value
  • GetClientIP() – Get visitor IP