Using Request and the Tracing method in a function
-
I'm using page tracing method and instead of writing it over and over, I wanted to write a function in a .cs page and just call the function from my other pages. Here is my code: public void pageTracing() { if (Request["trace"] == "trace") { Trace.isEnabled = true; } } It's giving me these errors: The name 'Request' does not exist in the class or namespace 'web_isotope.functions.clsFunctions' The type or namespace name 'Trace' could not be found (are you missing a using directive or an assembly reference?) If you please could, give me an example of the correct way to do this, I'm just beginning, thanks in advance!
-
I'm using page tracing method and instead of writing it over and over, I wanted to write a function in a .cs page and just call the function from my other pages. Here is my code: public void pageTracing() { if (Request["trace"] == "trace") { Trace.isEnabled = true; } } It's giving me these errors: The name 'Request' does not exist in the class or namespace 'web_isotope.functions.clsFunctions' The type or namespace name 'Trace' could not be found (are you missing a using directive or an assembly reference?) If you please could, give me an example of the correct way to do this, I'm just beginning, thanks in advance!
Request
is member of HttpContext class and its part ofSystem.Web
namespace which is not added to your class . For playing with that in your class you have to useHttpContext.Current
roperty and pass it to aHttpContext
vatiable and use that forTrace
orRequest
. Mazy You're face to face, With the man who sold the world - David Bowie