<html xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:u1="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:u2="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:u3="">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--a:link
        {mso-style-priority:99;}
span.MSOHYPERLINK
        {mso-style-priority:99;}
a:visited
        {mso-style-priority:99;}
span.MSOHYPERLINKFOLLOWED
        {mso-style-priority:99;}
p
        {mso-style-priority:99;}

 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.emailstyle18
        {font-family:Arial;
        color:navy;}
span.EmailStyle19
        {font-family:Tahoma;
        color:#1F497D;}
span.EmailStyle20
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Pano Voudouris
[mailto:pvoudouris@gaiocorp.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Thursday, July
 09, 2009</span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span
 style='font-size:10.0pt;font-family:Tahoma'>11:48 AM</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> Suman Chatterjee<br>
<b><span style='font-weight:bold'>Cc:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [mapserver-users]
Object reference not set to an instance of an object</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'>Hi Suman,</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'>Check your web.config file- You probably have an entry similar
to:</span></font></p>

<p class=MsoNormal style='margin-left:.5in;text-autospace:none'><font size=2
color=blue face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'><</span></font><font size=2 color="#a31515" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>appSettings</span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>        <</span></font><font
size=2 color="#a31515" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>add</span></font><font size=2
color=blue face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'> </span></font><font size=2 color=red face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:red'>key</span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>=</span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>"<font color=blue><span
style='color:blue'>mapfile</span></font>"<font color=blue><span
style='color:blue'> </span></font><font color=red><span style='color:red'>value</span></font><font
color=blue><span style='color:blue'>=</span></font>"<font color=blue><span
style='color:blue'>C:\ms4w\Apache\htdocs\...addison.map</span></font>"<font
color=blue><span style='color:blue'>/></span></font></span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>…</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'>In your code you want to create the mapfile object by reading
the mapfile path from web.config. So what you need to do is:</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'> </span></font></p>

<p style='margin-left:1.0in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>mapObj map= new
mapObj(System.Configuration.ConfigurationManager.AppSettings[“</span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>mapfile”]</span></font><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>.toString())</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span style='font-size:9.0pt;font-family:Tahoma;color:#1F497D'>(or
whatever the variable in the web.config is called)</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'>You don’t really want to use a constant to point to the
mapfile...</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'> </span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span lang=EN-GB style='font-size:9.0pt;font-family:Tahoma;
color:#1F497D'>Pano</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=1 color="#1f497d"
face=Tahoma><span style='font-size:9.0pt;font-family:Tahoma;color:#1F497D'> </span></font></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal style='margin-left:1.0in'><b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;font-weight:bold'>From:</span></font></b><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
mapserver-users-bounces@lists.osgeo.org
[mailto:mapserver-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Suman Chatterjee<br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>09 July 2009</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>17:50</span></font><font
size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> Tamas Szekeres<br>
<b><span style='font-weight:bold'>Cc:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [mapserver-users]
Object reference not set to an instance of an object</span></font></p>

</div>

</div>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>Hi,</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>I
corrected my problem. Actually, I changed the code a little bit. </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>Const
string MAP_FILE = “c:/inetpub/wwwroot/Addison.map”</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>Map= new
mapObj(MAP_FILE)</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>The line
 </span></font><font size=2 color=red face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:red'>System.Configuration.ConfigurationManager.AppSettings[“C:/ms4w/Apache/htdocs/mapservertest/Addison.map”]</span></font> 
</p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> Is throwing error. No idea what it is trying to
do.</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>Now my application is working fine in IIS and C#.</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>Suman</span></font></p>

<p class=MsoNormal style='margin-left:1.0in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>

<p class=MsoNormal style='margin-left:1.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Tamas Szekeres
[mailto:szekerest@gmail.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> </span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>Wednesday, July
 08, 2009</span></font><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'> </span></font><font size=2 face=Tahoma><span
 style='font-size:10.0pt;font-family:Tahoma'>6:22 PM</span></font><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> Suman Chatterjee<br>
<b><span style='font-weight:bold'>Cc:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapserver-users]
Object reference not set to an instance of an object</span></font></p>

<p class=MsoNormal style='margin-left:1.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

<p class=MsoNormal style='margin-right:0in;margin-bottom:12.0pt;margin-left:
1.5in'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Hi
Suman,<br>
<br>
I suspect  </span></font><font size=2 color=red face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:red'>System.Configuration.ConfigurationManager.AppSettings[“C:/ms4w/Apache/htdocs/mapservertest/Addison.map”]</span></font> 
evaluates to null in your case, and therefore the ToString() operation on the
null reference is failing which problem is not related to the MapScript library
itself.<br>
<br>
Best regards,<br>
<br>
Tamas</p>

<div>

<p class=MsoNormal style='margin-left:1.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>2009/7/8 Suman Chatterjee <<a
href="mailto:schatterjee@addisontx.gov">schatterjee@addisontx.gov</a>></span></font></p>

<div>

<div>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Hi all,</span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>I am trying to develop an application in C# (VS2005)
with mapscript. I saw the material of Paolo. But I am facing a problem </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>In the line </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>mapObj map= new
mapObj(System.Configuration.ConfigurationManager.AppSettings[“C:/ms4w/Apache/htdocs/mapservertest/Addison.map”].toString())</span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>It is generating the error “ Object reference
not set to an instance of an object”</span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>How can I correct this? If anyone helps me in
correcting it, it will be great.</span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Suman</span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

<p style='margin-left:1.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>

</div>

<p style='margin-right:0in;margin-bottom:0in;margin-left:1.5in;margin-bottom:
.0001pt'><font size=1 face=Arial><span style='font-size:8.0pt;font-family:Arial'>*******************************************************************************************************************
</span></font></p>

<p style='margin-right:0in;margin-bottom:0in;margin-left:1.5in;margin-bottom:
.0001pt'><font size=1 face=Arial><span style='font-size:8.0pt;font-family:Arial'>This
e-mail and any files or attachments transmitted with it contains Information
that is confidential and privileged. This document may contain Protected Health
Information (PHI) or other information that is intended only for the use of the
individual(s) and entity(ies) to whom it is addressed. If you are the intended
recipient, further disclosures are prohibited without proper authorization. If
you are not the intended recipient, any disclosure, copying, printing, or use
of this information is strictly prohibited and possibly a violation of federal
or state law and regulations. If you have received this information in error,
please delete it and notify Hamid Khaleghipour at 972-450-2868 immediately.
Thank you. </span></font></p>

<p style='margin-right:0in;margin-bottom:0in;margin-left:1.5in;margin-bottom:
.0001pt'><font size=1 face=Arial><span style='font-size:8.0pt;font-family:Arial'>*******************************************************************************************************************
</span></font></p>

</div>

<p class=MsoNormal style='margin-right:0in;margin-bottom:12.0pt;margin-left:
1.5in'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a></span></font></p>

</div>

<p class=MsoNormal style='margin-left:1.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'> </span></font></p>

</div>

</body>

</html>