1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem creating file from subdomain

Discussion in 'C#' started by AstarothSolutions, Jun 12, 2007.

  1. #1
    I have a domain and subdomain set up.

    Both of these have the identical peice of code:

    Dim objStreamWriter As IO.StreamWriter = IO.File.CreateText(datename)
    objStreamWriter.Write(strRequestedHTML)
    objStreamWriter.Close()

    with the one slight difference in the file name (one has a "d" at the end the other has a "s")

    Both run on the same machine, both write to the same directory.

    The domain script works without any problems but the subdomain throws the below error:

    Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Given they are identical bar the fact one is a subdomain and one letter i cant see why the above is occuring on one and not the other.

    Anyone have any suggestions?

    Cheers
     
    AstarothSolutions, Jun 12, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Verify that all permissions are set to write to that directory from all asp.net accounts, I believe in IIS6 its network service and in IIS5 it's ASPNET account. Just make sure all accounts can write. To test, use the exact same script in both locations, if they both can write, then you have another issue... maybe you are trying to write a file that SVN or SourceSafe sees as "can only be hidden or readonly" files? hopefully this gets you on the right track ;)
     
    ccoonen, Jun 12, 2007 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    They write to the same directory (slightly different file name in creation) and the subdomain is on the same server as the original so I assume would therefore have the same access levels. This mini-site is on a shared hosting solution (IIS6) and only a HELM control panel.

    The file name is simply todays date in "yy-mm-dd" format with one have -d.txt at the end and the other having -s.txt so I cannot see one hitting a hidden/ read only issue and the other not.

    Will try moving the code into the domain folder and see if this fixes the problem or not.
     
    AstarothSolutions, Jun 14, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    hmm, good luck sir :)
     
    ccoonen, Jun 14, 2007 IP