You can access the current Session via HttpContext.Current - a static property through which you can retrieve the HttpContext instance that applies to the current web request. This is a common pattern in static App Code and static page methods.
string s = (string)HttpContext.Current.Session["UserName"];
The same technique is used to access the Session from within ASMX web methods decorated with [WebMethod(EnableSession = true)] because whilst such methods are not static they do not inherit from Page and thus do not have direct access to a Session property.
Static code can access the Application Cache in the same way:
string var1 = (string)HttpContext.Current.Cache["Var1"];
If the static code is inside another  project we need to reference System.Web.dll. However, in this case it is generally best to avoid such a dependency because if the code is called from outside of an ASP.NET context HttpContext.Current will be null, for obvious reasons. Instead, we can require a HttpSessionState as an argument (we'll still need the reference to System.Web of course):
public static class SomeLibraryClass
{
    public static string SomeLibraryFunction(HttpSessionState session)
    {
       ...
    }
}
Call:
[WebMethod]
public static string GetName()
{
    return SomeLibraryClass.SomeLibraryFunction(HttpContext.Current.Session);
}