Forum Discussion
hardsoft_au
Jul 08, 2022Copper Contributor
Converting and old 4.7 app to .net6 and unsure how to change old calls to methods which are not in 6
I am converting an old app to .net6 but cannot find a solution for a couple of errors which I am getting.
Any help would be appreciated
public static DbConnection Connection(HttpContextBase httpContext, string configurationFileName, string connectionName)
{
Sources.ImportXmlStore(httpContext.Server.MapPath(configurationFileName));
return Connection(connectionName);
}error occuring on HttpContextBase
internal static Configuration Find(string name)
{
// Search configurations used and imported from xml stores.
Configuration configuration = _configurations.Value.Find(c => c.Name == name);
if (configuration != null) return configuration;
// TODO: Search configurations in settings.setting.
// Search configurations in web.config and <applicationname>.config.
var newconfiguration = new Configuration()
{
Name = name,
ConnectionString = WebConfigurationManager.ConnectionStrings[name].ConnectionString,
ProviderName = WebConfigurationManager.ConnectionStrings[name].ProviderName,
Provider = AddProvider(WebConfigurationManager.ConnectionStrings[name].ProviderName)
};
_configurations.Value.Add(newconfiguration);
return newconfiguration;
}
Error occuring on ConnectionString[name]
References are
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 Microsoft.Web.Administration;
2 Replies
- LanHuangFormer Employee
Hi hardsoft_au,
Thanks for posting your issue here.
However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang - iPazookiCopper ContributorCould you provide more details about the error code? Error detail or stack trace etc.