Hot answers tagged

9

In short, there's another web.config file in the LAYOUTS folder in the 14 hive that you need to change, it's set out fairly well here: http://web.archive.org/web/20130909002813/http://www.khamis.net/blog/Lists/Posts/Post.aspx?ID=12


7

Really confusing in SP2010, but you need to change the following web.config. "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config"


6

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 ...


6

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 = ...


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

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 ...


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

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

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

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

Use the object model (SPWebconfigModification), it applies the changes to all the web front ends of the specific web app you're working with.


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

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 ...


4

For security reasons, you cannot access the web.config settings from javascript so the best approach would probably be to write a custom control / web part that can read the setting and then write it into the page into a script block.


4

Yes, the nodes are being alphabetically sorted and the Sequence property only applies when the Name property is exactly the same. To fix, use a little XPath trickery to get your nodes to sort in the correct order (first modules[1=1] then modules[2=2]): SPSecurity.RunWithElevatedPrivileges(delegate { SPWebService spWebService = ...


4

No, you can't have different web.config for different site collections, however you maybe be able to add tweaks e.g. HttpModule and HttpHandlers configurations to it depending on your requirements...


3

Try adding Both Delegate controls and it should resolve your problem.


3

It sound's like the web applications get a timeout and does not get created correctly. I've had this problem in both production and staging environment, and changing the time-out has worked perfect both times. This is usually because you either have too many Web Applications in your SharePoint Server, or because your SharePoint Server is slow! As part ...


3

Microsoft's pattern and practices group has published guidance, including a hierarchical configuration manager library. The library uses a list or property bags. You can read more at http://www.microsoft.com/spg. (I would avoid web.config - the change management process for web.config in SharePoint is not reliable.)


3

You could store the connection string in an SPPersistedObject which you could then modify via PowerShell. You can also store it in the SPFarm or SPWeb property bag. I prefer the SPPersistedObject. You can see a real-world implementation of that here: https://github.com/Nauplius/FoundationSync/blob/2013/FoundationSyncSettings.cs


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 ...


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

You can open web.config in your timer job. How could you do it you can read this post. But the approach with property of timer job is easily. )


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

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 ...


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

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 ...



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