views:

65

answers:

2

Hi,

These lines cause a security exception in a godaddy account. Any suggestions how to rewrite to get this to work?

File.Delete(PropsFileName);  // Clean up

TextWriter tw = new StreamWriter(PropsFileName);    // Create & open the file
tw.WriteLine(DateTime.Now);  // Write the date for reference
tw.WriteLine(TokenLine);     // Write the BinarySecurityToken
tw.WriteLine(ConvIdLine);    // Write the ConversationId
tw.WriteLine(ipccLine);  // Write the IPCC
tw.Close();

Thanks!

The information is being written to session.properties variable in the temp directory.

A: 

You should give NTFS permissions to the user running your ASP.NET app. Your hosting control panel probably supports assigning NTFS permissions to the folder.

Mehrdad Afshari
+1  A: 

GoDaddy is set up to run under Medium trust, to simulate this on localhost add the following to your web.config:

<system.web>
    <trust level="Medium" />
</system.web>

Something you can try to fix the issues is to add the following to your AssemblyInfo.cs under Project > Properties in solution explorer

[assembly: AllowPartiallyTrustedCallers]

Also here is an article that may or may not help you out and/or give you insight regarding a similar situation with NHibernate: NHibernate in a Medium Trust Environment

Jon Erickson