Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Change Theme in web.config dynamically in Shared Hosting

Reply
Thread Tools

Change Theme in web.config dynamically in Shared Hosting

 
 
vikramp
Guest
Posts: n/a
 
      10-31-2006
Hi,

I am storing theme in web.config using <pages theme="mytheme"/>.
I am then using the following code to read it from my webpage:

Configuration config =
WebConfigurationManager.OpenWebConfiguration("~");
PagesSection section =
(PagesSection)config.GetSection("system.web/pages");
string currenttheme = section.Theme;

and then to change the theme and save it back in web.config, I am using
the following code:

Configuration config =
WebConfigurationManager.OpenWebConfiguration("~");
PagesSection section =
(PagesSection)config.GetSection("system.web/pages");
section.Theme = newtheme;
config.Save();

This works perfectly fine on my machine. But when I upload it on my
website, it throws security exception. I am hosting my site on godaddy
with Shared Hosting.

I then made changes in the code for reading the theme: Instead of
saying:

Configuration config =
WebConfigurationManager.OpenWebConfiguration("~");
PagesSection section =
(PagesSection)config.GetSection("system.web/pages");

I changed it to:
PagesSection section =
(PagesSection)WebConfigurationManager.GetSection(" system.web/pages");

This worked. But when it comes to saving theme back to web.config, I
get an error "The configuration is read only".

I guess it is because I am on shared hosting and aspnet or
NetworkService account do not have permission to modify web.config,

Is that the reason? or is it something else? Is there any workaround?

Appreciate your help.

Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Hosting, Reseller Hosting, and Dedicated Hosting!!!!!! teo1991 Ruby 0 04-02-2009 01:50 PM
Web Hosting, Reseller Hosting, and Dedicated Hosting!!!!!! ufi02 ASP .Net 0 03-27-2009 07:49 PM
Location of Shared Theme Items Redhairs ASP .Net 2 01-09-2008 05:53 PM
Change page theme with Atlas Matteo Migliore ASP .Net 0 02-24-2007 11:20 PM
Dynamically using .resx resources on a per-theme basis markarichman@gmail.com ASP .Net 0 03-02-2006 01:04 AM



Advertisments