C# - Encrypting Class Library App.config File?
Jan 5, 2011
share your thoughts if there is any way to encrypt app.config section with out changing code? I know that we can use aspnet_regiis.exe to encrypt the web.config file.
I came across some blogs to rename app.config to web.config and run aspnet_regiis -pef command. I am able to create an encrypted version of app.config file but application failed to read the keys from encrypted app.config. so this approach didnt work for me.
View 1 Replies
Similar Messages:
Jul 8, 2010
I a custom config file which I am having problems reading from a class project, is there a simple way to do this? the path does not seem to be getting picked up in code, where as this works in a web project
View 2 Replies
Jan 6, 2011
I'm struggling to find a way of specifying a file location in web.config appSettings that avoids using hard-coded paths but allows a non-'web aware' C# library to find a file. The C# library uses standard File.Open, File.Exists methods, etc. to operate on a data file, which is stored in my web application (ASP.NET MVC) tree, e.g. under:
contentdataMyDataFile.txt
Requirements:
I want to be able to specify my path like, e.g.:
<appSettings>
this--> <add key="MyFileLocation" value="~contentdataMyDataFile.txt" />
not --> <add key="MyFileLocation" value="c:inetpubwwwrootfoocontentdataMyDataFile.txt" />
</appSettings>
I don't want the C# library to be aware of the web application it's being used in, as it is used in other software, and the web application has no need to know about the configuration of the C# library.
View 3 Replies
Feb 4, 2011
Any section in my web.config file that I want to encrypt I run this command line util:
aspnet_regiis -pe "anySection" -app "/SampleApplication"
It all works just fine until I try encrypt my connectionStrings sections
I define (and I cannot change this) my connectionStrings section like this:
[code]....
Is there a way of doing this using the aspnet_regiis util? Doing it with code is not an option for me.
Also is there a way to run this untility without specifing the application (-app "/SampleApplication") instead giving the path to the web.config file?
View 2 Replies
Sep 23, 2010
If I encrypt something in my config file using aspnet_regiis.exe -pef "appsettings" "path" which i think will use my logged in id's credentials. If i deploy this application on some other machine where some other user id is used to login. Will there be any issues or .......?
View 1 Replies
Feb 7, 2011
I am encrypying my .NET config file using this command and it works just fine:
aspnet_regiis -pe "connectionStrings" -app "/SampleApplication"
For this to work though I have to have a virtual directory called SampleApplication pointing to the folder my web.config file is under.
Is there a way to just specify the path to the file and not have to have a virtual dir?
I tried with
aspnet_regiis -pe "connectionStrings" -location "c:FoldercontainingWebConfigFile"
but i get the error: " path attribute must be a relative virtual path". And cannot contain any of ":" "" etc...
I am looking here:
[URL]
View 3 Replies
Sep 23, 2010
Is aspnet_regiis.exe secure? If i encrypt using aspnet_regiis.exe, will it automatically decrypt the string and wont give any error? Need an insight into this stuff.... Is Rsa the best option or wat? Wat's the best way to encrypt/decrypt programmatically?
View 10 Replies
Dec 30, 2010
i have a class library that get a xml file and read it and set some property from that data
may code is like:
[Code]....
the problem is this code is in class library and the file is in web form application.
View 1 Replies
Jun 17, 2010
how to create a class library file and how to implement in web forms?
View 3 Replies
Aug 31, 2010
I have an asp.net application which employs a class project to process xml files. I have an xsd file within the class project. To load the xsd file, I am not sure which path I should use. The following code snippet loads the xsd, and reads the xsd using the StreamReader. I am not sure how to set the value for xsdPath variable.
[Code]....
View 1 Replies
Jan 10, 2011
I have a custom gridview control which is a class library project.I want to be able to specify the css class for the gridview which I can do.But I also want to set a default css stylesheet to the gridview. So if I don't override it using the cssclass property it must get it's cssclass from the default stylesheet I have in my project.
How can I specify the default stylesheet. I have a stylesheet in a folder called "Styles" in my project.
View 4 Replies
Mar 12, 2010
My company has several class libraries we use in multiple website projects (not web application projects). Website projects don't have .sln files, but I'm sure I've read in my past research that you can make a blank solution and put your website and class library projects in it. After answers to my previous questions, this is the direction that I'm going (based slightly on [URL]
/websites
/website1
/trunk
/website1
/libraries
/library1
/trunk
/library1
/library2
/trunk
/library2
/etc...
Then I planed on using svn:externals to copy /library1, /library2, and so on into the working_copy/websites/website1/ folder. I want my team members to be able to checkout the /trunk folder for website1 and get a .sln file, /library1 external, /library2 external, etc. I want that .sln file to contain the website1 website project, and all of the library external projects. Hopefully that would look something like:
/working_copy
/websites
/website1
/trunk
/website1
/library1 (svn:external of libraries/library1/trunk/library1)
/library2 (svn:external of libraries/library2/trunk/library2)
/etc.
website1.sln
So, at the end of all of this, the goal is that my teammates check out the trunk, open the solution, and everyone has the exact same solution. When we commit, everything is committed appropriately to subversion (the website code, and the libraries are committed to their appropriate place on the repo). How have others solved these issues? How can I make a .sln file that my team members and I can share in this manner?
View 2 Replies
Feb 19, 2010
I have an c# Class Library where I need some dynamic template based text. Instead of inventing my own template parser I thought I could create an aspx file in my project that is executed at runtime and, instead of viewing the output in a browser, I want a StreamReader or string object that holds the result.
View 3 Replies
Mar 5, 2010
I am using file upload control in aspx page. I want to put file upload logic in class library. but not getting how to distribute logic.
View 2 Replies
May 3, 2010
I am wondering how to encrypt the below information in the "web.config" file of the "Account" folder (where we have the secured pages):
[Code]....
My issue here is that even after I compiled my application (using "aspnet_compiler -v /reports c:
eports"), the information inside the web.config file of the Account folder still not encrypted, and I want to publish my site to the customer server. So, since this server is a customer server, then they can access this "web.config" file and change our web-application security behaviour (correct me if I am wrong). Basically, I don't want the customer to even have access to our secured pages when they access our web-application using the web browser. How to solve this issue?
View 2 Replies
Aug 17, 2010
I used the article Creating a Flexible Configuration Section Handler to create a Flexible Configuration Section Handler in my application.
I also saw this article entitled Encrypting Custom Configuration Sections on the OdeToCode blog, on how to encrypt portions of a web.config file.
From the first article, we have this web.config code.
[code]...
View 2 Replies
Aug 26, 2010
I am getting the error "An error occurred loading a configuration file: Access to the path is denied."
When I am in VS 2010, I can Encrypt as long as I run as administrator. Code as follows:
[Code]....
My problem is I need to run this in IIS. What is stopping me? It's a permission problem, but what permission. I am running IIS 7.5 on Windows 7. This is happening on my production server as well. Same error.
View 1 Replies
Jan 13, 2010
I have many ASP.NET applications running on server and i want to encrypt the web.config file for each.Is there a way I can encrypt all config files using single class/app or do i have to write separate code under each solution/project to encrypt config?I have idea how to do one file in a project usinghttp://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspxBut i want to use a centralized or single app to encrypt all
View 2 Replies
Oct 3, 2010
I'm trying to encrypt a custom section in a web.config file. When I get to the line that calls ProtectSection(), I get an exception saying the provider isn't found.
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("MySection");
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
I tried it with RSA as well and got the same error.
Running aspnet_regiis.exe works, but I need to do this programatically.
View 1 Replies
Nov 12, 2010
I have written a couple methods that encrypt and decrypt the appSettings section of my web.config file using the WebConfigurationManager. I just hooked up the methods to the page_load event to test that it works, which it does. Now I need to deploy to a web farm and need advice. What is the best way to make it so I can encrypt, but more importantly decrypt the web.config when I need to? I thought about putting a hidden page with "encrypt" and "decrypt" buttons, but that seems risky. What is the "accepted" method for rolling out something like this?
View 1 Replies
Oct 25, 2010
I have a class library and was to add a resource file to it to support both English and Spanish. Any tips as how I can do this? The language will be dictated by the user visiting the site. Would like to have to only load each resource file once and cache or set in static variable and avoid any overheads.
View 2 Replies
May 27, 2010
My problem is that I'm going to have a SQL Server database and website that accesses that database via a hosting provider, most likely GoDaddy.com, using ASP.Net. I need to make sure the connection string in the web.config file is as secure as possible, because the database will actually be storing trivia questions for a game I'm developing, and the clients will be accessing these questions, saving specific state related details, and other details, to the database, so every player that plays the game will have their details stored in this database. I need to ensure hacking is very difficult to accomplish.
From my research it appears as though the only viable solution for your web.config when you've got a hosting account with something like GoDaddy.com is to use SQL Server security to connect to your SQL Server database and place those details in the web.config file. Is this correct? It seems that this is the most likely scenario for most users, because we don't have access to our hosting providers IIS servers in order to use Windows authentication with SQL Server access and then use DPAPI encryption from there.
View 2 Replies
Mar 30, 2010
When I try to encrypt the "connectionStrings" section in the web.config file of my asp.net web application on Windows Server 2008, I'm getting the following error:
Administration utility (2.0.50727) to install and uninstall ASP.NET on the local machine. Copyright (c) Microsoft Corporation. All rights reserved. Note: This utility has limited capabilities on the Windows Vista operating system. It is recommended that you use the "Turn on or off Windows features" option of the "Programs" component of Control Panel to install or remove ASP.NET. It is also recommended that you use the IIS Manager component or the Appcmd.exe tool to configure ASP.NET applications.
The above information is followed by the list of valid options to aspnet_regiis.exe.
The command that I've used is:
aspnet_regiis.exe -pef "connectionStrings" "C:Usersuser1DocumentsMywebsite" -prov "DataProtectionConfigurationProvider"
But, the same command is working fine when used on a Windows Server 2003 machine. The problem is occurring only on Windows Server 2008 with IIS7.
View 1 Replies
Sep 16, 2010
I have this Control directive in a usercontrol (i've changed the namespace and class name):
<%@ Control Language="C#" AutoEventWireup="true" Inherits="Namespace.Path.To.ClassName" %>
<asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" ValidationGroup="comment" />
ClassName is a class that lives in a class library and this is the class:
namespace Namespace.Path.To
{
public class ClassName : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.TextBox txtComment;
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.Write(txtComment == null);
HttpContext.Current.Response.End();
}
View 3 Replies
Nov 14, 2010
I am relatively new to asp.net environment.Recently working on a project, i discovered a problemi.e. I had to add using system.io to all file functions in any page. same for using sql functionsi.e. any method for that namespace had to be used in full like By adding the following section in web.config , ALL my pages automatically have access to that namespace
<namespaces>
<add namespace="System.Data"/>
<add namespace="System.Data.SqlClient"/>
<add namespace= "MySql.Data.MySqlClient"/>
<add namespace="System.IO"/>
</namespaces>
[code]...
View 2 Replies