c# - adding and maintaining named strings in a seperate class file in asp.net -
I have developed an asp.net web application that contains 40-50 pages. I have implemented logger using log4net and this is in the page_load event of each of my pages.
Secure Zero Page_load (object sender, event order e) {try {log. Debug ("page load function"); If (! IsPostBack) {if (session ["OrgId"] = null) {// my argument} other {Response.Redirect ("Homepage.aspx? Sid = 1", wrong); } Logs. Debug ("Page Load Function Successful"); }} Hold (exception before) {log. Error (ex.Message, ex); }}
This method contains several code such as "code load function", "orgId", "homepage.aspx? Sid = 1", "page load function successfull" / code>. Now I would like to maintain these strings which are common in a separate class file in my application and use it with a variable ...
Can you suggest that for this Or what type of square can be used to deal with your way.
You can create a base page with this base, where you have // my logic
Add a call to an abstract method ( load_page
, for example). Then subdivide all your other pages with it and override them from load_page
, that contains all the logic you need.
It will put all these stars in one place, though I do not know why you need to make them change.
Comments
Post a Comment