web-config

stuck with enable session state

hi i have an application wherein i am accessing the Session object in the CommonCode.cs file that resides in the App_Code folder. But when the session object is accessed the application throws me an error: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. ...

Session timeout issue

I have a role based ASP.NET C# web application in which I am putting the menu object inside a session and I have a session timeout configured in the web.config as below: <forms defaultUrl="Home.aspx" loginUrl="Login.aspx" name=".ASPXFORMSAUTH" timeout="10"></forms> I first logged into the system as an employee and waited until the se...

How to read local customconfig.xml with xElement in C#

Hi, I have added a customConfig.xml to my project. I'm struggling to read the file into xElement because I need a file path. Any help is greatly appreciated. Thank you ...

Can't add new sections into app.config

Each time I try to add a very basic section into app.config I get the following error: Configuration system failed to initialize. I have looked at the variety of articles but none of those has helped so far. Any ideas what is going wrong? Edit: <configSections> <section name="Test" type="TestType"/> </configSections> <Tes...

Get the file path of current application's config file

The reason I asked this question is that I wanted to create a helper class for Remoting instantiation, and wanted to pass the appropriate app.exe.config (or web.config) file path to the RemotingConfiguration.Configure method, depending on the caller. Is there a way I could get the name of the config file for both Win and Web apps withou...

Remove XML comments using Visual Studio 2010 Web Config Transformation

We are using Team Build to handle our deployments to our development server, and we have a need to remove comments from our web config when it's transformed. Does anyone know how to remove the "" comment lines from the web config file using a transformation? ...

Migrated to ASP.NET 4.0 on IIS 7 and can not get custom errors to work

I have an ASP.NET Web Application project that used to target ASP.NET 2.0. I installed ASP.NET 4.0 on the web server hosting the web application and changed the web application project to target .NET 4.0. Everything works ok with on exception: Custom Error Handling Before migrating to .NET 4.0, custom errors used to work. In my appli...

What happens if I don't specify targetFramework="4.0" ?

In my ASP.Net 4.0 web.config I had the following attribute: <compilation targetFramework="4.0"> If I remove the targetFramework attribute, everything appears to carry on as normal. Under what circumstances does this attribute help me? ...

Is it possible to register a WebControl in the global namespace?

I doubt it is good practice but I was wondering if it is possible to register a control that is in the global namespace. something like <pages> <controls> <add namespace="global" assembly="MyControlAssembly" tagPrefix="mca" /> </controls> </pages> Thanks! ...

web.config overrides app.config...why?

Hi, I have two DLLs: one with a web.config, another one with app.config I moved the connection strings from web.config to app.config so that it can be used by other DLLs. Now, when I call ConfigurationManager.GetSection("SomeSection") , the application looks for a web.config, when it should be looking for the app.config. It doesn't ...

Can configSource point to another DLL?

Hi, Is it possible for a configSource to point to another DLL? For example configSource = "SomeOtherDllName.connectionStrings.config" Thank you ...

Web.config HttpHandler pain

Hi all, I've got a .net 3.5 website I've got two types of page, ones that create images and ones that display Html via a in-house framework. I've got a handler that deals with that in-house framework. It works and does a bunch of logging, its called SMS.OutputReporting.Handler the two images pages are normal aspx pages with .Net Syst...

Error in web.config

hai, i am trying to add functionality of DotNetNuke CMS with NopCommerce project my error is Parse error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. <customErrors mode="Remot...

Web.Config error

hi i want to add DotNetNuke website functionality in NopCommerce project, so i have added DotnetNuke folders,web.config,pages(ASP.Net VB) at admin folder in Nopcommerce(Asp.net c#) project. i have two web.configs one at in admin Folder and other is in Root i have added DotnetNuke web.config in Root web.config of Nopcommerce my error i...

How do I make my ASP.NET application serve pages only over HTTPS?

I want my application to serve all of its web pages over SSL, so I added the lines... <secureWebPages enabled="true"> <directory path="." /> </secureWebPages> ... to my Web.config and the resulting compiler error is: Build (web): Unrecognized configuration section secureWebPages. I am running Visual Studio 2008 ...

Limit URL Parameter Length in Web.Config

Is it possible to add some kind of restriction to the web.config to limit URL parameter length? I want to prevent people at the earliest possible point from submitting too large URL parameters so the server doesn't get taxed more than necessary in the event that somebody tries to "attack" it with large invalid URL parameters. ...

How can my .Net app determine whether to use app.config or web.config

I have a class that needs to get some settings from the application configuration file and that is used in a console based app and a web app. Other than catching an exception how can I determine whether to use: ServiceModelSectionGroup serviceModelSectionGroup = ServiceModelSectionGroup.GetSectionGroup(ConfigurationManager.OpenExeConfi...

Alternatives to web.config files in ASP.NET

In my experience, web.config files are widely reviled. In particular, I have found them difficult to manage when you have multiple environments to support, and fiddly to update due to the lack of validation at update-time and the verbosity of XML. What are the alternatives? ...

How to read a "xxx.config" file with out .net BCL in asp.net

I am using this solution to read config file , But the inexplicable errors occur,sometimes it work fine,but on some machine it does not work. So I'm looking for another solution with out built-in .NET BCL,please help me. ...

Asp.Net Error Message in Event Viewer:Unable to validate data

We have a Asp.Net Webform page which contains a GridView inside UpdatePanel and refreshes every minute. And every one minute we get the following error in Event log. Error Message:Unable to validate data. Stack Trace: at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, I...