Since there is no inheritance of the PAGE class in the class, the service uses the server.mappath () function. So implement this feature, we need to do the following.
First, you must reference the System.Web namespace, then use the following method to get the path ~
String strpath = system.Web.httpContext.current.server.mappath ("test.txt");