.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Why are folder web.config files excluded?

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
I am asking this mainly out of curiosity. When access rules are created for folders using WSAT, web.config files are generated in these folders. I thought these rules should be deployed with the application (It is at least the case for all my applications), but these file are not included after creation so they are not deployed by default. What is the rationale behind this?

View Complete Post

More Related Resource Links

Help with authorization in web.config to deny access to files in a folder



I have a web site that has a folder called Files that contains PDF files.  These PDF files should not be accessible to people who have not signed in to the web site. 

The login URL is www.mysite.com/Account/Login.aspx and the register URL is www.mysite.com/Account/Register.aspx. 

Once the person is signed in they can go to www.mysite.com/Documents/Documents.aspx.  This page has a gridview that lists the PDF files in the Files folder with a link to them.  If the person is not signed in, he/she can't view this Documents.aspx page.  However, if anyone has the URL to the PDF files, they can view those files without having to sign in.

How can I prevent someone from accessing the PDF files in this folder?

The site is hosted on GoDaddy using IIS 6.0.

Thanks in advance.

Clean Web.Config Files (VS 2010 and .NET 4.0 Series)

.NET 4 includes a new version of the CLR, and a new .NET 4 specific machine.config file (which is installed side-by-side with the one used by .NET 2, .NET 3 and .NET 3.5).

The new .NET 4 machine.config file now automatically registers all of the ASP.NET tag sections, handlers and modules that we've added over the years, including the functionality for:

.ASP.NET Dynamic Data
.ASP.NET Routing (which can now be used for both ASP.NET WebForms and ASP.NET MVC)
.ASP.NET Chart Control (which now ships built-into ASP.NET V4)
What this means is that when you create a new "Empty ASP.NET application" project in VS 2010, you'll find that the new default application-level web.config file is now clean and simple:

reading values from config files in NUnit tests


One of my NUnit tests has to read in some values from config files.  In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in.  Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work.  Are there any special steps involved when reading from config files in an nunit test ?

NUnit and config files


Ive created an NUnit test project in my solution and have added 3 tests.  They all fail with the same error

SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.


SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.

  ----> System.NullReferenceException : Object reference not set to an instance of an object.

heres the test method

        public void CreateDataContext_ConnectionString_ReturnsDataCon

The ASP Column: What's in ASP.NET Config Files?


Even though you've been using ASP. NET for a while, how much do you really know about ASP. NET configuration files? While you've probably touched the Web. config file from time to time, there are some nuances involved in configuring ASP.

George Shepherd

MSDN Magazine September 2004

Copying files to a folder on web server



I have few files in FolderA on the web server.

I want the users to select a fews files from FolderA and copy them to FolderB on the same web server.

I want to list all the files in FolderA and allow the user to select a few files and copy.

I want to copy the files programatically when the user selects a few files and click on Copy button.

How to copy the files quickly from folderA to FolderB?




How to use Resource files added to Resources Folder ?



I have added .CSS file in Resources folder of the project.In the same way i can add Images or any other files.But i am unable to use those files in Server Control Project.How to apply CssClass property to any predefined server control to the css file that is stored in the Resources folder  ?

Please guide how to use those Resource files . 

how to read config details from multiple config files

Hi, My web application contain 3 config files with different names, ex. firstconfig.config, secondconfig.config, thirdconfig.config.  Each config files have same Key Value pairs. Now what i want to do is, based on the condition i want to read specific info from specific config file. What i tried is, in Web.config files  <appSettings file="firstconfig.config"></appSettings>   In this way i get th info from that particular config file.  Now how do i get details from other 2 config files.   Can any one know abt this.   S. Ramkumar  Smiley

Updating Config Files in Sharepoint Farm

I am trying to update config files web.comnfig in the Virtual Directory of my server so that users are allowed to upload more that 50 MB of files in my IIS 7 server. Everytime i do the update it works fine but after few days when there are few changes then it removes the added elements itself and restore in the Original Stage. I used to edit my config files manually. I found a way of creating a config files and saving it to the Config Directory under 12 Hive in Server. Like the Content will be similar as follows <actions>    <add path="configuration/SharePoint/SafeControls">       <SafeControl          Assembly="System.Web, Version=1.0.5000.0, Culture=neutral,             PublicKeyToken=b03f5f7f11d50a3a"          Namespace="System.Web.UI.WebControls"          TypeName="*"          Safe="True"/>    </add>   </actions> I have to add following line <system.webServer>     <security>       <requestFiltering>         <requestLimits maxAllowedCon

Deploy folder for a .rdl files

In a win form app, i use a report viewer for local reporting, the troble is: I can't find a "Aplication relative folder" where to strore those .rdl files, so i can find them in a run time. Thks for any ideas. I'm using vb2010 express an sql 2008 expressDANIEL CABAÑAS LEÓN - I'M NOT AFRAID TO DIE, I'M NOT AFRAID TO LIVE

Need Best Practices for SSI packages (dtsx-files + ONE config)

Please advice hot to keep connection string for many packages at one place. Idea is to have one .dtsConfig-file for each iteas is not acceptable. DEV, TEST and PROD - different virtual computers. Each one can have it's own config-file lying in one and the same folder (c:\bi\configs\)

HTTPRequest web.config: files only?

Hello.I'm trying to use HTTP handler.this is the URL to my web service:  http://localhost/VirDir/WebService/ApplicationsWS.asmx/Reporthttp://localhost/VirDir/WebService/ApplicationsWS.asmx/FlushI want handler to each one (Report / Flush) but they are not actual files.for the Report I tried (in web.config - httpHandlers):path="Report*"path="*Report*"path="*Report"but nothing work.just this work:path="*"and with this I can't direct to Report or to Flush.Can I set it by query string parameter?What can I do?Thanks.

Copy files from one folder to another

hi  I am able to create a folder but is not able to copy files from the source to the newly created folder. Is there something that i missed out? Thanks  Dim sitename As String = "~/site/" & txtUsername.Text Directory.CreateDirectory(Server.MapPath(sitename))            Try                Dim f() As String = Directory.GetFiles("/site/source/")                For i As Integer = 0 To UBound(f)                    File.Copy(f(i), Server.MapPath(sitename) & "\" & (f(i)))                Next            Catch ex As ExceptionEnd Try  

How to run exe in different folder than dll files

Hello, How can I run de exe file in a different folder than the dll files? Now ill get the error: " Could not load file or assembly 'Pangaea.CMS.Module, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified" thx

Querystring to determine what Document Library Folder's files to list?

First of all, any webpart that alllows you to list documents in a particular folder of a Document library? Second, possible to pass what folder to list via a query string to  that webpart ? Thanks.

Securing files using Handler and App_Data folder

HiI have secured some files on my webserver by putting them into the App_Data folder in the root (I do not have the option to secure folders using the ASAPI filter)The user gets access to these files by requesting them through a handler, fx. by requesting ~/Handler.ashx?file=App_Data/MySubFolder/MyFile.jpgNow, I want to make all the content in a specific folder called "Members" (a single subdirectory of the App_Data folder) available only by passing a specific password. That is by requesting ~/Handler.ashx?file=App_Data/MySubFolder/MyFile.jpg&password=xxxxIn my Handler.ashx I have written some logic seeking if InStr(context.Request.QueryString("file"), "Members") = 0 before sending the file. If inStr <> 0 a password is required.Is this a good way to secure a folder in and its content? Is there a way of getting access anyway, like using some kind of "sub-directory" line in the path (the same way as you can request parent directory by using "../../Myfile.jpg)? I know there will be a problem if someone fx. legitimately tries to access the file App_Data/Members.jpgThanks in advance!-Jesper

Authorization tag in Web.Config in MVC folder


I created a new MVC Web Application (not the empty one -- the one with the Account controller stuff).

I created a new folder under Views and placed a new View in it.

I created a Controller for the Folder.

I created a web.config in the Folder and used this content:

 <?xml version="1.0"?>
      <deny users="?" />

When I run the app, I can visit my new View even though I'm an anonymous user.

What gives? Do the web.config authorization rules not apply to MVC? Do I have to do something to the Controller or to the web.config or to the root web.config?

Help is appreciated.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend