Ok Found part of my solution here c# - Is ConfigurationManager.AppSettings available in .NET Core 2.0? - Stack Overflow[^] I installed System.Configuration.ConfigurationManager from Nuget into my .net core 2.2 application. I then reference using System.Configuration; Next, I changed WebConfigurationManager.AppSettings to .. ConfigurationManager.AppSettings
hardsoft
Posts
-
Need help advice -
Need help adviceHi Gerry Thank you for your reply but that is not the issue. I have that issue is the following is not in 6.0 I have the following at the beginning of my code.
Quote:
using System; using System.Collections.Generic; using System.Data.Common; using System.Linq; using System.Xml.Linq; using System.Security.Cryptography; using System.Web; // requires a reference to System.Web.dll using System.Web.Configuration; // requires a reference to System.Configuration.dll
I cannot find a reference to items in bold so looking for how to reproduce the same functionality System.Web.Configuration was required for HttpContextBase and WebConfigurationManager
Quote:
using System.Web.Configuration; // requires a reference to System.Configuration.dll HttpContextBase httpContext ConnectionString = WebConfigurationManager.ConnectionStrings[name].ConnectionString
-
Need help adviceI have an app in csharp dot net version 4.7.1 and moving to dotnet version 6. The snippet of code from 4.7.1 is
Quote:
using System.Web; // requires a reference to System.Web.dll using System.Web.Configuration; // requires a reference to System.Configuration.dll /// /// Imports an xml store by it's relative path in ASP.NET and returns the requested connection. /// Does not open the connection. /// /// Context of HTTP request to resolve relative path with. (e.g. HttpContext.Current) /// Full or relative server path. (e.g. ~/App_Data/databases.xml) /// Returns a new instance of the provider's class that represents a connection to the database. public static DbConnection Open(HttpContextBase httpContext, string configurationFileName, string connectionName) { DbConnection connection = Connection(httpContext, configurationFileName, connectionName); connection.Open(); return connection; } /// /// Imports an xml store by it's relative path in ASP.NET and returns the requested connection. /// Does not open the connection. /// /// Context of HTTP request to resolve relative path with. (e.g. HttpContext.Current) /// Full or relative server path. (e.g. ~/App_Data/databases.xml) /// Returns a new instance of the provider's class that represents a connection to the database. /// Returns a new instance of the provider's class that represents a connection to the database. public static DbConnection Connection(HttpContextBase httpContext, string configurationFileName, string connectionName) { Sources.ImportXmlStore(httpContext.Server.MapPath(configurationFileName)); return Connection(connectionName); }
I cannot use using System.Web; using System.Web.Configuration; as these don't exist in 6.0 so would appreciate help on how to convert the following to keep the same functionality.
Quote:
DbConnection connection = Connection(httpContext, configurat
-
Uninstall on shutdownYou could set registry entries to remove the application on a windows startup. you would run your app. set the registry entries (runonce) on restart the runonce would take effect and remove your app during windows startup.
-
Lighten area of a imageI have a app which places a watermark (text) on an image and saves this back to a file. What I would like to do is lighten a rectangle area behind the text so the text is clearer. Can anyone point me to articles which would show how to lighten an area. I found many which show how to lighten/darken the image (bitmap) but noe for an area.
-
Get a list of System Font SizesThank you for this info. I know what I need to do now.
-
Get a list of System Font SizesI want to have a dropdown combo box with a list of font sizes(point size) for the user to select from. The combo box is to be like that used in MS word etc. Is there a way to do this for any c# built in call or should I create the list myself by supplying the values to the combo box. Regards Jeff.
-
Place Form windows at certain position in MDI ApplicationI want to place a MDI form at a certain position in relation to the MDI background application window. Ie. When I display a certain form I would like to display the form on the right of the applications MDI window and locatthis child form in the top right corner. How could I achieve this in c#.
-
connection more than 10 machines.I have this issue with schools who cannot afford a windows 2003 server (the software is free under a M$ agreement). To over come this I use an old PC with a large hard drive and a FreeNAS server (http://sourceforge.net/projects/freenas/). In 30 min you can have server up and running and use PC's and Mac's from the one file server.
-
TextBoxI was at a training session yesterday and noticed the developers has placed a small red triangle in the top left corner of a text box to indicate the field was a mandatory field. I thought this would be nice to do in my apps. Does anyone know where I could learn procedure on how to make a custom control like this. Regards Jeff