Out of Date Documentation

Topics: General Topics, SharpMap v0.9 / v1.x, Web Controls
Editor
Aug 19, 2014 at 3:58 PM
Edited Aug 19, 2014 at 4:00 PM
Two things:

Can you see what might be wrong with this. All I get is a red X for the image. I have added an image called imgMap to the web page and I am setting the map to that image in the Generate Map().

public partial class WebForm1 : System.Web.UI.Page
{
    SharpMap.Map CountyMap;

    protected void Page_Load(object sender, EventArgs e)
    {

        CountyMap = new SharpMap.Map(new Size(200, 200));
        VectorLayer CountySHPLayer = new SharpMap.Layers.VectorLayer("County");
        CountySHPLayer.DataSource = new SharpMap.Data.Providers.ShapeFile("C:\\shp\\oc.shp", true);
        CountyMap.Layers.Add(CountySHPLayer);
        CountyMap.ZoomToExtents();

         GenerateMap();

    }


    private void GenerateMap()
    {
        System.Drawing.Image img = CountyMap.GetMap();
        string imgID = Caching.InsertIntoCache(1, img);
        imgMap.ImageUrl = "getMap.aspx?ID=" + HttpUtility.UrlEncode(imgID);
    }
}
Can I help get this project better documented. It is so out of date. There are references to namespaces that don't exist any more. I am basically googling my issue than comparing all the people who had similar issues and going with the most recent one. Its an awesome project that just needs a little nerdy TLC :)
Editor
Aug 19, 2014 at 8:25 PM
UPDATE: I have already been added as a developer so I can assist with getting the documentation corrected.
I still however need help with the 1st issue which is why the code is not displaying a map.
Coordinator
Aug 19, 2014 at 9:54 PM
I've made a quick check. The code works if you use VisualStudio Development Server, if you use IIS Express it does not.
I assume that you need to change some setting for IIS Express to make it work, but Web, IIS is not at all my domain.

Here is my web.config
<?xml version="1.0"?>
<configuration>
    <system.webServer>
      <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>
    <system.web>
    <compilation debug="true" targetFramework="4.0.3">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <httpHandlers>
        <add verb="*" path="GetMap.aspx" type="SharpMap.Web.HttpHandler, SharpMap.Web, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"/>
    </httpHandlers>
  </system.web>
</configuration>
Coordinator
Aug 19, 2014 at 10:00 PM
If you use IIS7 (express och standard) you need to have the handler-registration in the <system.webServer><httpHandlers> section instead of in <system.web><httpHandlers>

So the config in IIS should look like:
<?xml version="1.0"?>
<configuration>
<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <httpHandlers>
    <add name="GetMapHandler" verb="*" path="GetMap.aspx" type="SharpMap.Web.HttpHandler, SharpMap.Web, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"/>
   </httpHandlers>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0.3">
  <assemblies>
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>
</compilation>
</system.web>
</configuration>
Editor
Aug 19, 2014 at 10:20 PM
I did yours exactly as a copy and paste into notepad ad it returned this exception warning:
 The element 'system.webServer' has invalid child element 'httpHandlers'. List of possible elements expected: 'asp, caching, cgi, defaultDocument, directoryBrowse, globalModules, handlers, httpCompression, httpErrors, httpLogging, httpProtocol, httpRedirect, httpTracing, isapiFilters, modules, odbcLogging, security, serverRuntime, serverSideInclude, staticContent, tracing, urlCompression, validation, management'.    
I assume you mean the application's web.config.
Editor
Aug 19, 2014 at 10:30 PM
Edited Aug 19, 2014 at 10:32 PM
The correct code that worked for me is this:
<?xml version="1.0"?>
<configuration>
  <system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
    <add name="GetMapHandler" verb="*" path="GetMap.aspx" type="SharpMap.Web.HttpHandler, SharpMap.Web, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"/>
 </handlers>
  </system.webServer>
  <system.web>
<compilation debug="true" targetFramework="4.0.3">
  <assemblies>
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
  </assemblies>
</compilation>
  </system.web>
</configuration>
Editor
Aug 25, 2014 at 5:12 PM
Edited Aug 25, 2014 at 5:13 PM
One more important note as I had to figure these out myself:
You need these:
using SharpMap;
using SharpMap.Layers;
using SharpMap.Web;
using System.Drawing;