I have a function in a class file called auth_user and its in App_code folder.
I am trying to call that function from random pages that are on the website.
Inside the class file is a function that is simple, basicly check for flags in the sessions, i just wanna have it there so i dont have to type it again and again.
I want to be able to call it with one function like auth_user();
How would i do this excetly ?
would the function be public static void or what ?
Static makes sense for this:
And then you would call it:
Edit Based on Comments
So, not to be rude, but that information in your comments would’ve been pertinent in your original question and saved a fair amount of time.
Regardless, you’ll need to pass in either the current HTTPContext or the Current Session into your static method:
And the you would call it: