Instead of MgSite, I usually use MgSiteConnection.. Dim siteConnection As MgSiteConnection = New MgSiteConnection()
siteConnection.Open(userInfo) (sorry vb example) On Wed, Nov 5, 2025 at 4:23 PM Greg Neff via mapguide-users < [email protected]> wrote: > MGOS 4 Final > > Iis 10 > > .net 4.8 > > > > Working on moving a site to MGOS 4 and having trouble creating a session > using this code below which gives the following error: > > > > *The type initializer for 'OSGeo.MapGuide.WebUnmanagedApiPINVOKE' threw an > exception.* > > > > *public partial class Cid_Map : System.Web.UI.Page > <http://System.Web.UI.Page>* > > *{* > > * public string webLayout = > "Library://layouts/Cid_Map_Basic.WebLayout";* > > * public string defaultUser = "Anonymous";* > > * public string defaultPassword = "";* > > * public string sessionId = "";* > > > > * protected void Page_Load(object sender, EventArgs e)* > > * {* > > > > * try* > > * {* > > * string realPath = > Request.ServerVariables["APPL_PHYSICAL_PATH"];* > > * realPath = realPath.Replace(@"Cid_Map\", "");* > > * string configPath = realPath + "webconfig.ini";* > > * //Response.Write(configPath);* > > * MapGuideApi.MgInitializeWebTier(configPath);* > > * MgUserInformation userinfo = new > OSGeo.MapGuide.MgUserInformation(defaultUser, defaultPassword);* > > * MgSite site = new MgSite();* > > * site.Open(userinfo);* > > * sessionId = site.CreateSession();* > > * }* > > * catch (Exception ex)* > > * {* > > * Response.Write(ex.Message);* > > * sessionId = "";* > > * }* > > > > * }* > > *}* > > > > Any help would be appreciated. > > > > > > > > *Gregory B. Neff* > > Cottonwood Improvement District > > 8620 S Highland Dr > > Sandy, UT 84093 > > 801.943.7671 > > cottonwoodimprovement.gov > > > _______________________________________________ > mapguide-users mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/mapguide-users >
_______________________________________________ mapguide-users mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/mapguide-users
