This project is read-only.

Xml issue!

Oct 4, 2009 at 10:35 PM

Hi there!

I am working on a extension, which content act as the source during a page_load of site.master. The result should be creation of a XML file called Addrotator.xml in a Theme.

Please take a look of the source code here:

Everything run as a dream in vs2009, but I get a HTTP 500 on my test server with IIS 6.0 on win2003.
No XML file is written, although the Theme has the same security permissions as  App_Data.

Any help will be appreciated!

Thanks in advance


Oct 5, 2009 at 11:02 AM

Glancing at the code, I think the problem may be with the MapPath() function call.  You didn't create your own custom MapPath() function, right?

The Server.MapPath() function that is built into .NET is to create a file/path to a physical location on the hard drive.  / is the URL to your site, but doesn't have anything to do with the physical file location on the server.  It should probably instead be:


This would return a value looking something like:


You might need to remove the leading \\ from target_xmlFileName to avoid two backslashes if you also get a backslash from MapPath().

Oct 6, 2009 at 12:42 AM

Hi Ben

Fine guess! You hit the target – I’m on the road again.

What is the reason for this difference? Is it a bug in Visual Studio or what?

This works in Visual Studio:
target_xmlFileName =” \\themes\\Triathlon\\Addrotator.xml”
mySite = MapPath("/")

This works on the IIS:
target_xmlFileName =” themes\\Triathlon\\Addrotator.xml”
mySite = MapPath("~/")

In both cases holds target_xmlFileName = mySite + target_xmlFileName
the same value – “C:\\Inet\\wwwroot\\website\\\\themes\\Triathlon\\Addrotator.xml”

Anyhow Ben, Many thanks