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

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

The Best Place to store Settings for Web Application.

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :ASP.Net
I want to create an Application Setting or Control Value for "Application Run Mode", which will indicate if the application is in Testing Mode or Live Mode. So I have created this Enum Type: Public Enum AppRunModeType Live Testing End Enum and, this will be used inside the the Web Application to determine if the application run mode, and hide/show some UI Controls accordingly. This Setting "Application Run Mode" is not a User Setting, it is a setting to be controlled by the developer who is deploying the application. Where is the best place to store this value ? I am thinking there are 2 places: 1. In web.config "appSettings" secting, 2. Or in Project Properties Page/Settings Section. If I choose to store it in web.config, then, I will not be able to have Strong Type Access to the value like the Enum type, and I have to convert from Enum Type to String and vise versa. If I choose to store it in Project Properties Page/Settings Section, then I cannot do that, becuase my Web Application is not a Porject and I cannot find this page there, or I will have to convert the Web Application to a Web Application Porject, and this is a Long Story. Also, How I can access My.Settings object from the Web Application ? Appreciate if some one could point me to the right direction and the best way to hanlde such requirement.

View Complete Post

More Related Resource Links

Use ASP.NET Membership store for user settings with Windwos Authentication

I am evaluating ASP.NET Membership for an intranet Silverlight app. I want users to be automatically authenticated for my application with their windows logon.Thus I configured Windows Authentication.I would like to store user settings like email-address in using the SqlMembershipProvider and not AD. It seems that storing user settings using the SqlMembershipProvider is not supported with Windows Authentication. Is this really so (using .NET 4)? If so: What is the rationale behind this?IMHO authentication, user settings and authorization are distinct aspects.User settings could easily be stored (identified by user name) using the SqlMembershipProvider with authentication and password management being supplied by Windows. What is the recommended solution for my scenario?

How to Programatically SetCredentials for Secure Store Service Application in Sharepoint 2010 using

I have to setup Credentials for Secure Store Service application programatically. To get Stored Credentials I have following code and its working fine. using (SPSite site = new SPSite("http://vtlssp2010Dev")) //using (SPSite site = new SPSite("http://" + System.Environment.MachineName + "/sites/Site_Name"))d { Console.WriteLine(site.RootWeb.CurrentUser.Name); SPServiceContext context = SPServiceContext.GetContext(site); prov.Context = context; try { SecureStoreCredentialCollection cc = prov.GetCredentials(appID); foreach (SecureStoreCredential c in cc) { IntPtr ptr = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(c.Credential); string sDecrypString = System.Runtime.InteropServices.Marshal.PtrToStringUni(ptr); Console.WriteLine(sDecrypString); } } catch (Exception ex) { Console.WriteLine("Unable to get credentials for application " + appID); Console.WriteLine(ex.Message); } Console.ReadLine(); } } All I want is to programmatically do set credentials like explained in this example on msdn. http://msdn.microsoft.com/en-us/library/ff798456.aspx Please help. Shamshad Ali  

Secure Service Store and custom web application.

 Hello All,  I have a problem for which I would like to use the Secure Service Store.  I've searched for similar solutions involving the SSS but I've not had any success yet.  Maybe I'm missing something obvious or going about it the wrong way.   We have an external application (actually, a number of external applications) we'd like to embed in our SharePoint site using an iframe or the Page Viewer web part.  The embedded application uses a custom forms based authentication scheme and I want to prevent the situation where a user has to log into our application then log into the embedded application.  Is there anything available the help post the credentials from SSS to the custom application?  The only think I can think to do is write some code that mimics a post to the login page of the embedded app and, if needed, write a stripped down or simpler login page for the embedded app to make that easier.  For my immediate task I have quite a bit of control over the source of both application and could write custom code on both sides if I had to, but I'd rather have a solution that only involve configuration or, at most, custom code on the SharePoint side.  Thanks,  Brandon 

Create a new target application - Secure Store Service administration issues

Hi,I am trying to create new target application, when I go to Secure Store Service in Centra admin I have:Cannot complete this action as the Secure Store Shared Service is not responding. Please contact your administrator.I have used this few days ago and avarything else is working fine on the server, and I have applications created with it running fine.Any help is appreciated.cheersValko

error: "The application-specific permission settings do not grant Local Activation "

Log Name:      System Source:        Microsoft-Windows-DistributedCOM Date:          9/14/2010 11:55:35 AM Event ID:      10016 Task Category: None Level:         Error Keywords:      Classic User:         XXXXX\spadm Computer:      XXXX.XXXXX.com Description: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {61738644-F196-11D0-9953-00C04FD919C1}  and APPID {61738644-F196-11D0-9953-00C04FD919C1}  to the user XXXXX\spadm SID (S-1-5-21-6236335-3733969977-3477648964-5701) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">   <System>     <Provider Name="Microsoft-Windows-DistributedCOM" Guid="{1B562E86-B7AA-4131-BADC-B6F3A001407E}" EventSourceName="DCOM" />     <EventID Qualifiers="49152">10016</EventID>     <Version>0</Version>  &nb

Cache settings on shared application pool

I have several web applications on a server using the same application pool. The worker process usually takes a lot of ram but usually only from one application. I can successfully limit the cache usage by setting "PrivateBytesLimit" in web.config file when the application uses it own dedicated application pool. Does anyone know how this setting will be applied when using shared application pool? Is it per application, per worker process or per application pool? Also if it is not per application which setting from which application will be applied?

Store lists for an application different dropdownboxes?

Hi prosI have until now always stored my lists definitions for labels and values for dropdownboxes in my own defined Xml files. These lists labels I then match with a language file (.resx) ..... so far so good but now I am starting a new project. Should I continue with my old habbits or is there a better way of storing label constants for my dropdown boxes throughout my application?I would be happy skipping my read and write rutines for my onw structure if there is a better dedicated one for the purpose.Mr Virtual Office guy

Where can i place this line of code so that its accessible thruout my entire web application?


Currently im capturing the users name during certain functions, so at the moment, i have the line below within each event that i need that information. Instead of having that line everywhere, cant iplace that line in a class or something so that i can just access it by "usn" string usn = User.Identity.Name.ToString();

What's the best way to store Data from DataBase like XmlNode... Application vs Cache


 Hello, i am building an N-tier application now i want to store Data(like XmlNode) that is common to all users ..

now i thought using Application to hold the data but my data lays in the BLL tier which is an Class Library project and i can't store any datain there for example :

HttpApplication MyApp=new HttpApplication();



My question is what is the best way to store Data (not small data like user name etc..) is it Application? orCache?

i would like a small example within a ClassLibrary project...


Language settings in WPF application



Is there a way to change the keyboard layout for WPF applications according to the selected Region and Language settings of the system?

To explain more about the problem, please find the scenario below.

Normally, In English(US) culture, the decimal numbers are seperated by dot(.) seperator. But in Dutch(Netherlands), the decimal numbers are seperated by comma(,) seperator. After changing the Region and Culture settings to Dutch(Netherlands), if you open the excel sheet and type a number with number pad in the keyboard, when we you use dot(.) symbol in the number pad, it will be automatically replaced as comma(,) by the application. How can we achieve the same using our application in C#?

Thanks in Advance!!!!

Best Regards,
Subalakshmi Vijayarajan.

Application Settings Values


In my application settings, I know there are some default values that the application can read from, for instance, using a string value for the default directory (something like this if you wanted to set the default application directory to a text file:   |defaultapplicationdirectory|/logfile.txt)  I'm just using that as an example, I'm not sure if " |defaultapplicationdirectory| " is the correct format, but that's what I'm looking for.  I'm also wondering if there are other "default" terms that can be used in the app settings values and where can i find a list of those defaults that can be used there?

edit:  (Visual Basic Application settings for Windows Forms Applications)



I will be legendary someday, just not today.

Single Sign on - Manage settings for enterprise application definitions - Individual / Group



I am using Microsoft Single Sign On service in context to Sharepoint server 2007.

I want the external applications to use the single sign on service for authentication within a secure Enterprise portal environment.

Here the external application should be authenticated via single sign-on. But while configuring SSO in Share point central admin, it offers two methods of "Manage settings for enterprise application definitions" which is Individual and Group .

According to my requirements,

1. I need some set of users (may be a group of users) to make use of credential1 to authenticate the external application. so Group should be mapped to one common external credential1 .

2. I need rest of the users who does not belong to the above said user group should use individual external credentials mapped to Individual user .

I need both of these scenarios to be handles using a single Application definition created for my external application.

So suggest me an ideal way to achieve this mixed Individual and Group credential mapping in SSO



Thanks, Kesavamoorthi

Unable to set up a new Secure Store Service Application in a single-server installation


Problem: after initial SharePoint installation, I tried to add the Secure Store Service Application under "Manager Services Applications".  The process screen returns something like "The time job created.  But failed to start in one or more servers in the farm."  Further investigation found that in the SQL Server, the secure service account was not added under the Login user accounts.  The Secure_Store_Service_DB has been created, but not under the name of secure store service account.  In another word, the database was created but the action seems to be incomplete.

Background: this is a single server farm installation on Windows Server 2008 R2, SQL Server 2008 R2, with AD CS and AD DS, DNS roles enabled on the same box.  The configuration task was running with the farm admin account which is also a domain admin, and has dbcreator, securityadmin, and sysadmin roles in the SQL server.


User-specific application settings vs Isolated Storage


I was wondering what's the difference between these two ways to store user-specific settings.

In isolated storage you're supposed to have the security that the path to the files is unknown. But MSDN still recommends not to store sensitive information. On the other hand, user-specific settings, maybe with default values in the app.config file, are also stored in a randomly generated folder. In this case I imagine that you can encrypt the user settings the same way you do with the app.config file.

My question is, what are the advantages of using one method over the other to store user-specific settings?

Defining a regular expression in the application settings xml file.


I have a little question about application settings. I have a regular expression in my code which should be customizable by the user so I made an application setting for it.  The regular expression is used in a class in the project and has the following value

Dim email_regularex As String

So now I made a new Settings file in my project and gave the following value for this string in the settings file:



So when i do this in Visual Studio 2008, Visual Studio automatically creates a app.config xml file with the right settings in it.

But when I start my application and use the regular expression like this:


 myMatch As

 Match = Regex.Match(email, email_regularex)


 myMatch.Success Then

 MsgBox("Please enter a valid email address like: iiiiii@iii.com"

, MsgBoxStyle.Critical)


the application break

How and Where to store search parameters in MVC application


I am working on a railway web application and I have following layers:

ASP.NET MVC 2 (Presentation Layer) 
Services Layer 
Repository Layer 
Database & External Web Services as data sources (Using Entity Framework for Database) 

I pass Domain Entity Objects from Repository to Service layer and thinking of passing View Models from Service to Presentation layer. Website would require a login and after successful login I have to present a search screen with basic search (as default option) and option for advance search. Once user fills the search criteria I have to gather data from DB & Web Services and present the results to user. User would select a particular Rail option and would move on to other additional options page BUT they should be al

Incoming email settings on Application Template: Help Desk

I've installed the Help Desk application template and created a new
site based on it.  All looks great except that I can't figure out how
to set the site to receive incoming emails which would in turn create
a new service request.  Hopefully it's there and I'm just not seeing

TIA for your help.

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