<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-family: monospace; font-size: 13px;">Hi All,</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">I am using visual studio 2012 on a windows 7 enterprise pc. I created an asp.net web site and successfully installed the nuget package. (</span><a
href="https://nuget.org/packages/mapguide-api-web-x64" target="_blank" style="background-color: rgb(255, 255, 255); color: rgb(25, 106, 212); font-family: monospace; font-size: 13px;">https://nuget.org/packages/mapguide-api-web-x64</a><span style="font-family: monospace; font-size: 13px;">).</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">I then created a Default.aspx page with the following code:</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Page language="c#" Debug="true"%></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Import
Namespace="System.IO" %></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Import Namespace="System.Collections.Specialized" %></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Import Namespace="System.Text" %></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Import Namespace="System.Globalization" %></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%@ Import Namespace="OSGeo.MapGuide" %></span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%-- ? ?<!-- #Include File="utilityfunctions.aspx --> ? --%></span><br style="font-family:
monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><script runat="server"></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">String webLayout = "Library://Samples/Sheboygan/Layouts/SheboyganAsp.WebLayout";</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">String defaultUser = "Anonymous";</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">String defaultPassword = "";</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">String sessionId = "";</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">String configFilePath = "C:/Program
Files/OSGeo/MapGuide/Web/www/webconfig.ini";</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">//String configFilePath = "C:/Program Files/OSGeo/MapGuide/Web/www";</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">//String configFilePath = "@C:\Program Files\OSGeo\MapGuide\Web\www\webconfig.ini";</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">??</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"></script></span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><%</span><br
style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? try</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? {</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? // Initialize a session and register a variable to hold the</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? // session id, then initialize the Web Extensions, connect</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? // to the site, and create a session.</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ?
MapGuideApi.MgInitializeWebTier(configFilePath);</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? MgUserInformation userInfo = new MgUserInformation(defaultUser, defaultPassword);</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? MgSite site = new MgSite();</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? site.Open(userInfo);</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? sessionId = site.CreateSession();</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? }</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family:
monospace; font-size: 13px;">? ? catch (Exception e)</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? {</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ?</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ? Response.Write(" map guide error: " + e.Message);</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ??</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? ? ??</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">? ? }</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">%></span><br
style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><html></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><head></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><title>Viewer Sample Application</title></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"></head></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><frameset rows="30,*" frameborder="no" framespacing="0"></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><frame id="titleFrame" frameborder="no" marginwidth="0" marginheight="0"
scrolling="no" src="title.html"></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"><frame id="viewerFrame" frameborder="no" marginwidth="0" marginheight="0" scrolling="no" src="../mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>"></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"></frameset></span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;"></html></span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">The error I am now getting is " The type initializer for
'OSGeo.MapGuide.MapGuideApiPINVOKE' threw an exception ". I am using the 64bit version of map guide 2.5.2.</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">?</span><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">Any ideas ?</span><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><br style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">Regards,</span><br></div></div></body></html>