Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 03, 2012 11:20 AM by subodhpatil
0 Points
4 Posts
Mar 30, 2012 01:11 PM|LINK
I have multiple location tag specified for allowing multiple pages.
<location path="UserManagement/ResetPassword.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="SupportTicketDetails.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>
I need to get list of all pages programatically in c# of all these pages.
So with above configuration I should have alist which contains UserManagement/ResetPassword.aspx, SupportTicketDetails.aspx.
Alternatively; is there any method in asp.net framework to which if I say SupportTicketDetails.aspx then if should return me true.
Note:
UrlAuthorizationModule.CheckUrlAccessForPrincipal(Request.Url.AbsolutePath, HttpContext.Current.User, HttpContext.Current.Request.HttpMethod); //
Above does not work in this case as it return true for every page in the site when user is logged in.
Thanks,
Subodh
Contributor
2293 Points
468 Posts
Mar 30, 2012 03:20 PM|LINK
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap(); configFileMap.ExeConfigFilename = Server.MapPath("/web.config"); Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None); ConfigurationLocationCollection myLocationCollection = config.Locations; foreach (ConfigurationLocation myLocation in myLocationCollection) { Response.Write(String.Format("Location Path: {0}", myLocation.Path)); Configuration myLocationConfiguration = myLocation.OpenConfiguration(); Response.Write(String.Format("Location Configuration File Path: {0}", myLocationConfiguration.FilePath)); }
Apr 03, 2012 11:20 AM|LINK
This code does not work.
config.Locations.Count is always 0.
subodhpatil
0 Points
4 Posts
Get list of all authorized pages specified in location tag of web.config
Mar 30, 2012 01:11 PM|LINK
I have multiple location tag specified for allowing multiple pages.
<location path="UserManagement/ResetPassword.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="SupportTicketDetails.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location>I need to get list of all pages programatically in c# of all these pages.
So with above configuration I should have alist which contains UserManagement/ResetPassword.aspx, SupportTicketDetails.aspx.
Alternatively; is there any method in asp.net framework to which if I say SupportTicketDetails.aspx then if should return me true.
Note:
Above does not work in this case as it return true for every page in the site when user is logged in.
Thanks,
Subodh
d4daud
Contributor
2293 Points
468 Posts
Re: Get list of all authorized pages specified in location tag of web.config
Mar 30, 2012 03:20 PM|LINK
ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap(); configFileMap.ExeConfigFilename = Server.MapPath("/web.config"); Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None); ConfigurationLocationCollection myLocationCollection = config.Locations; foreach (ConfigurationLocation myLocation in myLocationCollection) { Response.Write(String.Format("Location Path: {0}", myLocation.Path)); Configuration myLocationConfiguration = myLocation.OpenConfiguration(); Response.Write(String.Format("Location Configuration File Path: {0}", myLocationConfiguration.FilePath)); }subodhpatil
0 Points
4 Posts
Re: Get list of all authorized pages specified in location tag of web.config
Apr 03, 2012 11:20 AM|LINK
This code does not work.
config.Locations.Count is always 0.