web-config

Web.config can't see my assembly

I'm getting errors when I try to reference one of my assemblies in my ASP.NET web application's web.config. I'm trying to set up a <profile> provider, but when I removed the <profile> node, the next place it was referenced threw the same error. The error I'm getting is: CS0234: The type or namespace name 'MyNamespace' does not exist in...

Deny access to a folder in ASP.NET

Hi guys, is it possible to prevent browsing of a folder contents in an ASP.NET web application other than creating a default page, say using web.config? I would like to avoid using IIS for this if possible. Thanks ...

ASP.NET - encrypting confing sections - ProtectSection - RSAProtectedConfigurationProvider

I am developing a web application using vs2008 and used two accounts on Vista 64 bit - the original first admin account after the Vista install and now a power user account. I forgot what I did, but when I run SectionInformation.ProtectSection (System.Configuration) under the original account, the encryption of the config section work...

Serve .ICS files as binaries purely through .htaccess or apache conf

When I upload an .ICS file to the server and try to download it, it appears as text. I would like the "Save as" dialog to appear so that the user can open the file as a binary in Outlook. What can I put into the apache conf or .htaccess rule to make the headers for ICS files work like a binary. Example: A .doc file opens like a binary...

IIS7 & Castle.Microkernal.Lifestyle.PerWebRequestLifestyleModule regestering problems

I'm trying to deploy an ASP.NET MVC app to iis7 and am getting the error: Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule Add '<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel" />' to the <httpModules> section o...

How can you know that current request exceeds maxRequestLength in ASP.Net?

I'm developing a small web application in ASP.Net (framework version 3.5) using VS2008 and C# 3.0. There's a file upload, and I want to make sure that the whole request doesn't exceed 5 MB. I configured the web.config file and maxRequestLength is set properly. I'm overriding the page's OnError method. However, while investigating the ...

web.config and app.config confusion

I have a DLL that references a web service. The block it has put into the app.config is (I have changed the names but you'll get the idea): <applicationSettings> <DLLName.My.MySettings> <setting name="DLLName_WebReferenceName_ASMXName" serializeAs="String"> <value>http://URL/Filename.asmx&lt;/value&g...

How can I determine whether or not a SafeControls entry already exists for a given assembly

I have several features which are deploying web parts into a given site sollection. The WSPs were built using the WSPBuilder add-in to Visual Studio 2008. Although the SafeControls entry is always created in the manifest.xml it is not always added to the web.config on deployment. I beleive this may be due to the fact that I have inclu...

storing user info/pass in web.config authentication

Hello, I am trying to write a simple internal app with some simple authentication. I'm also trying to make this quick and learn about the forms authentication via web.config. So i have my authentication working if I hard code my 'user name' and 'password' into C# code and do a simple conditional. However, I'm having a tough time stori...

Run an ASP.NET website in a subfolder

Is there a way of running an ASP.NET website in a subfolder of the website? As an example, say I wanted to run the screwturn wiki (http://www.screwturn.eu/) in a folder called "wiki" on my website, can I alter the web.config of the screwturn website to tell it that it is running in the "wiki" folder? (like saying that "~/" = "/wiki/") ...

Reducing information disclosure in Tomcat error pages

By default, Tomcat's error pages disclose both the existence of Tomcat and the exact version of the container that's handling the requests. This is nice for development, but in a production context this information is a potential security hole and it would be nice to disable it. Thus I would like to know what the best (as in most strai...

web.config secure directory with gal group

So, I have the following in the web.config <authentication mode="Windows"/> <authorization> <allow users="domain\johndoe" /> <!--Deny All Others--> <deny users="*" /> </authorization> But, what I want to do, is only allow users in a specific GAL group on our AD server and that doesn't seem to work with these settin...

web Config files

Why do we need a web config file ...

trust medium in asp.net mvc

When i try to run my project in trust medium or high it says [PolicyException: Required permissions cannot be acquired.] [FileLoadException: Could not load file or assembly but i'm running all the assemblies in bin only. ...

Using <%$ %> in ASP.NET MVC

In ASP.NET WebForms you can reference appSettings directly in your markup with this syntax: <%$ MySettingKey %> Unfortunately this does not work in ASP.NET MVC because, as MSDN points out, this syntax only works in server controls. I've run into a few situations where I would love to use this syntactic sugar in an ASP.NET MVC view (W...

Generic Handler Registration in Web.Config

Hi, I've added a generic handler (ashx) in my project but I can't see it's registration in web.config and it works. How come ? I mean shouldn't visual studio add it as a http handler in web.config ? Or it is because I doesn't override any pre-defined handlers instead I am calling it specifically . Thanks in advance ? ...

Binding ASP.Net Web.Config Settings To .ASPX File <a href></a>!?

The Scenario I have an ASP.NET web project. I want to be able to define all of the links for the site inside my web.config file so that they can be changed easily if needs be. Currently I have an "" section in my web.config file. The Question How do I bind this key value pair to an '' tag in my .aspx file?! The App Settings in My Web...

In ASP.NET MVC, how can I load script from my view folder?

I've refactored some of my View's javascript out into .js files alongside the views (not in the Scripts folder off root). By default, the handler in web.config for the views stops these being loaded: <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/> However, I want to...

Change Web.config connectionStrings without resetting sessions

How can <connectionStrings> in Web.config be changed without resetting sessions of logged in users? I'd like to keep using <connectionStrings> instead of creating a custom section because I use LINQ and I don't want to have to hack my DBML. I know that session resets can be avoided using custom sections placed in a separate file with r...

How to stop inheritance of <configSections>in Web.Config

You simply cannot use <location path="." inheritInChildApplications="false"> in certain parts of your web.config in order to tell it to ignore inheritance of certain sections (you'll get errors such as 'inheritInChildApplications attribute is not declared' and so fourth if you try putting it in sections where it's not supported). For ...