Shared environment problems: Blog module

May 16, 2008 at 11:31 AM

Hi all!

I have a problem with the Blog Module, which runs perfectly in my testing environment, but not in production. I use shared hosting with medium trustlevel.

When i try to write a blog entry or a comment to an entry, the method SaveData in persist.cs throws a security exception and denies service. This happens, when writing data in the directory App_Data/Blog. Unfortunately the exception message gives no further information.

All rights for the ASPNET users are set. I see this, because the above mentioned method does write Data in this directory. But the xml-file, that is always well formed in my test environment, now is not valid.

When i click the save button, then the security exception raises and interrupts the writing process. The disturbed xml-file looks like this:

<BEGIN FILE EXAMPLE>

<?xml version="1.0"?>
<BlogData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entries>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="BlogEntries">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Guid" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string" />
                  <xs:element name="Title" type="xs:string" minOccurs="0" />
                  <xs:element name="Content" type="xs:string" minOccurs="0" />
                  <xs:element name="Created" type="xs:dateTime" minOccurs="0" />
                  <xs:element name="Updated" type="xs:dateTime" minOccurs="0" />
                  <xs:element name="Comments" msdata:DataType="System.Data.DataTable, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:anyType" minOccurs="0" />
                  <xs:element name="Tags" msdata:DataType="System.Collections.ArrayList, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:anyType" minOccurs="0" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>

          . . .

          [the scheme area is always well formed; the error raises always int he first blog entry section; it looks always like this:]

 

    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
      <NewDataSet>
        <BlogEntries diffgr:id="BlogEntries1" msdata:rowOrder="0">
          <Guid>240ad53c-0801-46f0-b816-860ecb603727</Guid>
          <Title>Test</Title>
          <Content>Test</Content>
          <Created>2008-05-16T12:58:46.5951013+02:00</Created>
          <Updated>2008-05-16T12:58:46.5951013+02:00</Updated>
          <Comments>
            <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
              <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="EntryComments" msdata:UseCurrentLocale="true">
                <xs:complexType>
                  <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="EntryComments">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Guid" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string" />
                          <xs:element name="Title" type="xs:string" minOccurs="0" />
                          <xs:element name="Content" type="xs:string" minOccurs="0" />
                          <xs:element name="Created" type="xs:dateTime" minOccurs="0" />
                          <xs:element name="Author" type="xs:string" minOccurs="0" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:choice>
                </xs:complexType>
                <xs:unique name="Constraint1" msdata:PrimaryKey="true">
                  <xs:selector xpath=".//EntryComments" />
                  <xs:field xpath="Guid" />
                </xs:unique>
              </xs:element>
            </xs:schema>
            <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" />

          [in every case the writing process ends at this point in the first blog entry, when the comment entries are expected!]

<END FILE EXAMPLE>

I think the problem is the double id "NewDataSet" in the scheme of the Blog as in the scheme of the blog comments DataTable. Besides: Even in the valid file the Visual Studio xml-Parser throws a warning and marks the <BlogEntries>-Tag with something like this: "element <EntryComments> expected ..."; this is the element defined in the second "NewDataSet" scheme.

I am now trying to rename this second "NewDatSet" in something like "CommentDataSet", because i think this could perhaps solve the problem and calm down the security instance of my web server. But the XmlSerializer does the naming completely automatic. The blog seems to be the only module with nested DataTables, so i can not imitate the procedere (that is the way i normally solve such problems ;-)).

Has anyone an idea?

Alex.