Results 1 to 4 of 4

Thread: How to do web.config for an application

  1. #1
    Join Date
    Feb 2009
    Posts
    69

    How to do web.config for an application

    How can I deny authenticated users with “Admin” or “Tenant” roles and allow the rest of the authenticated users with other roles in web.config file. A user can have more than 1 role. For example a user can be “Admin” and “Painter”. In the perfect situation my application should allow this user because he is “Painter” too. If he was only “Admin” or “Tenant” then he should be rejected.

  2. #2
    Join Date
    Dec 2008
    Posts
    93

    Re: How to do web.config for an application

    ASP.NET provides a configuration system we can use to keep our applications flexible at runtime.

    The <appSettings> element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

  3. #3
    Join Date
    Jan 2009
    Posts
    99

    Re: How to do web.config for an application

    Use the appSettings part of the Web.Config to store connection strings. This xml can then be modified anytime later and the next time a user browses to the site it will pick this new setting up.

    One connection string is to Oracle and the Other is to SQL server

    Code:
    <appSettings>
        <add key="ORACLEConnectionString" value="Provider=OraOLEDB.Oracle.1;
    Persist Security Info=False;Password=blah;User ID=greg;Data Source=sph;" />
        <add key="SQLConnectionString" value="data source=SQL1;initial catalog=ID_V;
    integrated security=SSPI;persist security info=False;workstation id=TH03D374;
    packet size=4096"/>   
    <appSettings>
    To get the values of the connections strings you would use

    Code:
    string conn = ConfigurationSettings.AppSettings["ORACLEConnectionString"];
    OleDbConnection myConnection = new OleDbConnection(conn);
    When the site goes live change the debug setting to false which will make the site have a little better performance.

    Code:
    <compilation defaultLanguage="C#" debug="true" />
    Customer errors can be handled be turned off but I prefer them to be turned on as below.

    Code:
    <customErrors mode="Off" />

  4. #4
    Join Date
    Jan 2009
    Posts
    92

    Re: How to do web.config for an application

    What is Web.Config File?

    Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.

    What is Machine.config File?

    As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

    What can be stored in Web.config file?

    There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..

    1. Database connections
    2. Session States
    3. Error Handling
    4. Security

Similar Threads

  1. Replies: 4
    Last Post: 07-04-2012, 07:19 PM
  2. Replies: 8
    Last Post: 18-04-2011, 08:09 AM
  3. Replies: 5
    Last Post: 17-04-2011, 08:51 AM
  4. Difference between Web.Config and Machine.Config File
    By Adrina_g in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 02:44 PM
  5. Modify app.config in C# application
    By Sean J in forum Software Development
    Replies: 5
    Last Post: 18-07-2009, 02:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,646,401.18759 seconds with 17 queries