Moving UseRewrite(bool) to SiteSettings.cs

Aug 23, 2011 at 5:31 PM

In /web/RewriteService.cs, line 43, there is a TODO: comment to move USE_REWRITE to SiteSettings. 

I tried to do this, move the rewrite settings to SiteSettings but it did not work due to security exception error. 

I added a new property called IsUseUrlRewrite in /Core/SiteSettings.cs. 

And then, I used "SiteSettingCache.GetSiteSettings()" in /web/rewriteService.cs, line 145, BuildGenericRewriteUrl function, to get the SiteSettings.IsUseUrlRewrite. An error of "System.Security.Securityexception: Request Failed" appears in here. To resolve the issue, I found this recommendation online, There are a lot of steps to get around the error and I don't believe this is the best one due to security risks involved in fixing it.

The security exception error message is: 

System.Security.Securityexception: Request Failed

Unless there is a better solution to the problem, I think we should move IsUseUrlRewrite in web.config to make it simple.