I just learned about session variables from another issue. Saw the potential problem with "static variable" with multiple people browsing my site. I do not know if my structure causes an instance of BLogic for each pages code behind and I am OK, or if I have been lucky due to only two developers using the site. How would one test something like this? Am I safe?
I have 3 layers
1) forms webpage
2) code behind // for web developers, format, controls, etc., minor logic
----public partial class Concantonate : System.Web.UI.Page
----protected void btnFormat_Click(object sender, EventArgs e)
----lblResultStringEmailPhoneNumber.Text = BLogic.FormatEmailPhoneNumber(ContactEmail, PhoneNumber);
3) BusinessLogic //all major logic, business flow etc
----public class BLogic
----public static string UniqueMessage;
----public static string FormatEmailPhoneNumber(ContactEmail, PhoneNumber)
I saw a lot of redundant code that the web developers were copy/paste to many code behind pages, they are already having trouble when a bug or change is made, hours of doing the exact change to many items. To reduce this I made another c# code page where I am putting all the redundant code, one place to update or fix bug. One potential problem is multiple users (above) and the second difficult access to session variables (so I am passing parameters in function calls) , everything seems to be working. I believe there is a way to extend, inherit, or somehow hook to the code behind pages, maybe I should instantiate an instance of the BLogic in each code behind page. Sorry my question may not be very clear but I hope I have communicate the objective, how is the correct ay to do this.