Tag Info

Hot answers tagged

5

Unfortunately you have reached the limits of what SPWebConfigModification can do, you need to do the changes manually, i like xml transforms. But once you know you need to do 'some' changes manually, you may as well to them all manually, because the SPWebConfigModification mods will conflict with your manual mods. And SPWebConfigModification's can not be ...


5

I've implemented this method in the past, so I just share my code with you: add: private void AddAuthorizedType(SPWebApplication webApplication, string assembly, string namespace_) { SPSecurity.RunWithElevatedPrivileges(delegate { var modification = new SPWebConfigModification(); modification.Path = ...


5

We've found it's much easier to just add a webconfig.something.xml file to the Config folder. So for your one entry you can create an xml file with these contents: <?xml version="1.0" encoding="utf-8" ?> <actions> <remove ...


5

I would use a SPWebConfigModification: http://msdn.microsoft.com/en-us/library/bb861909.aspx Something similar to this: SPWebConfigModification handlerMod = new SPWebConfigModification(); handlerMod.Path = "configuration/system.webServer/handlers"; handlerMod.Name = "add[@name='SomeHandler'][@type='SomeHandler']"; handlerMod.Type = ...


4

If you're getting this error on sharepoint/wss specific pages, you also have to add following fragment to your web.config to view the stacktrace: <SharePoint> <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"> <PageParserPaths> ...


4

Has someone been editing it in wordpad? Config files are UTF-8 and you're probably describing a character that is not in this set... Richer text editors sometimes replace things (such as replacing quotes with a curly representation that is actually another character altogether). Is there any indication as to what the characters should be?


4

Removing all of the entries is a common problem, especially if you try and do it as you have done (and to be honest how you would expect it to be done). The trick is to remove all of the entries based on a specified Owner, you could use the .Net Class name for example. Vince Rothwell has posted a great article on this and this is what I would regard as ...


4

I would recommend NOT to store appsettings in the web.config - use any other methods. SPWebConfigModifications are not reliable in all scenarions (just Bingle it and you'll find a plethora of posts about it). For instance the hierarchichal configuration storage in the P&P SharePoint guidance is a great way to store settings (http://spg.codeplex.com)


4

What are you using to make the edits? Can you try it from a different editor? Have you done a comparison of the modified and backup files with something like WinDiff (verify that truly only the time stamp changed and there isn't some obscure artifact being introduced). Verify the file encoding is the same and is not being changed when you save a new ...


4

I haven't actually tried this myself in 2010, but I didn't think it was necessary to edit the web.config file manually these days. AFAIK, SharePoint Foundation does not support the custom error pages that are typically used in IIS sites. Check out this post by Todd Carter. You could use a feature receiver to deploy a custom error page into the SharePoint ...


3

The problem is that in SharePoint, you have no idea how many web servers is running your site, and therefore you've no idea how many web.config's could be running (not you in particular, but in general, SharePoint can handle dozens of web front end servers). In order manage changes to the web.config file, the object model is design such that any and all ...


3

Most likely, you're activating the feature from Visual Studio. Here is a very interesting article about this issue from Waldek Mastykarz: Inconvenient SPWebConfigModification development with Visual Studio 2010 So, you should try to set "Activate on Default" property for the feature to False. About SPWebConfigModification class - I know at least 2 ...


3

Have you tried the following? In Central Admin > Operations > Services on Server Select your SQL server and stop the Windows SharePoint Services Web Application service (May have to select a custom role) NB - I haven't had the chance to try this out on a farm, so tread carefully!


3

You can declare an enum in your webpart and expose that as property. An enum will be rendered as a dropdown in the properties toolpane. If you need more complicated behavior you need to create a custom ToolPart. //create enum public enum MyColorEnum { Red = 0, Blue, Yellow }; protected MyColorEnum _color; [Personalizable(PersonalizationScope.User), ...


3

Is the UNC path location you're writing to in the same domain as the SharePoint server(s)? If so, then I would just grant access to the app pool service account only and run your filesystem write code block with elevated privileges: SPSecurity.RunWithElevatedPrivileges If not, then you will probably need to login as and impersonate an account within the ...


3

I'd take a look at the following: Sharepoint 2010 Custom Error Pages I don't think there's a need to do anything, but leave the pages alone in IIS. Place your custom error pages in the custerr directory Edit the web.config file for your webapp(s) Update the customErrors node to include your custom pages Update the httpError node to turn on custom errors ...


3

Please change your web.config file from: <PageParserPath VirtualPath="/TestSite/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true"/> to this: <PageParserPath VirtualPath="~/TestSite/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true"/> hope this help u..:)


3

Microsoft's patterns & practices group has published guidance for SharePoint 2010, including an heirarchical configuration storage provider as part of "The Application Setting Manager." Recommended.


3

I assume you need this because you want to control webpart properties from a central location. Below are the options you can consider : Use <appsettings> in web.config and read them using ConfigurationManager.AppSettings in webpart.This will allow you to store settings at the scope of web application. Use a list at Root site or subsites depending on ...


3

You should modify the one in TEMPLATE\LAYOUTS. See here for more information. Also there are several tweaks and settings you can adjust when working with large files Consider the footprint of those large files on your server resources. You are basically holding up one IIS thread during the entire upload, as well as causing it to load in memory on both your ...


3

There's nothing wrong with your code above, so this almost certainly has something to do with your SPWebConfigModification object's "Name" value. The SPWebConfigModification.Name property (and the Name parameter in the SPWebConfigModification's constructor) are actually XPath expressions that uniquely identify the config entry. SharePoint uses this XPath ...


2

I am assuming that the feature is web application scoped. Are you activating the feature through the browser (central admin)? Try activating it from powershell/stsadm instead. I have always found that if i try to modify the web.config, from the process that is using the web.config, things seem to go bad. function New-WebConfigMod { param( ...


2

If you're really sure you don't want to use SPWebConfigModification, you could look at SPWebService.ApplyApplicationContentToLocalServer() - this has the capability of merging entire sections into config files, but has the following caveats: Only applies to the local server (clue is in the name!) Must be called by a local administrator The combination of ...


2

Maybe you can try different approach. You can secure application in page code rather to alter/add web.config file(s). This link is bit old but for general info will be ok: http://msdn.microsoft.com/en-us/library/dd878359(v=office.12).aspx#SecuringAppPages_ValidatingUserPermissions I still have few scars left from my last fight with Sharepoint web.config.


2

Depending on what you're doing, a less-invasive option would be to store data in the property bag for the web application, which would avoid the need to modify the web.config. You can use the SharePoint Property Bag Settings 2010 project to add/manage property bag keys, or create them with PowerShell or an Event Receiver.


2

Here's what I have: <add name="portalsitea_C3Management" siteMapFile="/_app_bin/portalsitea/NLC3ManagementQuickLaunch.sitemap" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> I put my sitemaps in the _app_bin and they have a .sitemap extension. Note that I had some problems ...


2

1) register the HttpModule in the web.config for the Web application where you need it, in your case, C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config, use this page as a guide to how to register you HttpModule 2) You should sign the dll and deploy it to the GAC 3) You should really do this as Web Application scoped feature deployed in a WSP a using ...


2

If this is for SharePoint 2010, you should be able to set this value through SharePoint. Go to the site collection you are wanting to change this on. Click Site Actions > Site Settings > Navigation. There are options there for 'Maximum number of dynamic items to show within this level of navigation:' which is defaulted to 20. Change that to what ever ...


2

SharePoint is no different than ASP.NET as far as web.config entries are concerned. SharePoint's web.config content are different from a typical ASP.NET application though. So if your application depends on those settings, they would go into appSettings section of the web.config, just like ASP.NET applications. For storing custom application settings, I ...



Only top voted, non community-wiki answers of a minimum length are eligible