I have an ASP.NET WebForms application with something next to the lines of this file structure:
root\ default.aspx web.config subfolder\ page.aspx web.config
If I access page.aspx by going to locahost/subfolder/page.aspx , it reads web.config perfectly in the subfolder.
However, I have a way to customize the page:
protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } public void RegisterRoutes(RouteCollection routes) { routes.MapPageRoute("", "test", "~/subfolder/page.aspx"); }
And when I try to access the page through this route by going to localhost/test , the page loads just fine, but cannot read the values ββfrom web.config in a subfolder.
Am I missing something? Is there another step to let sub web.config work with routes?
I am accessing sub web.config using:
var test = WebConfigurationManager.AppSettings["testSetting"];
Wayne source share