We help IT Professionals succeed at work.

c#, .cs in app_codes

Webboy2008 used Ask the Experts™
1. I have at least five .cs in app_codes, and they are working fine. Now I want to add MasterCommon.cs and add some default value there like

And I want all five .cs is able to read, for example, MasterWebsiteName, how can I do that?

2. Now all .cs files are in app_codes, and it works fine. However, if I want to move all five .cs files to a folder in the root directory, how can I add the reference there?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

1. Mark as pubic or internal. public string MasterWebsiteName
2.No need to change anything. I would recommend to leave tem in App_Code as such.


The reason I want to leave App_Code because I have to let the master codes sharing with other website.

Can you tell me how to do  the item 1 that you mentioned?
Chief Technology Ninja
Distinguished Expert 2018
"other websites"? What do you mean by this?

If you want your code accessible by your current project you mark it as internal, if you want to allow access by external code , you mark it as public. As such in App_Code everything is accesible by your current project unless n until explicitly marked.