tags:

views:

190

answers:

2

Hi!

I am new to .NET and have a problem. I have an app that creates a security token to use remote web services. When I run the app locally on my machine it works fine (in the Visual Web Developer Express 2008). I then took a shared hosting Windows account on godaddy.com. When I publish the site and then check online, I get the error:

Server Error in '/' Application.

Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

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

Any suggestions where I can check for the problem? Is it my app? A limitation of godaddy?

Thanks!

A: 

Basically what is happening is that your application is trying to write to the file system and it is getting a permissions error due to not being granted permissions. There are a few things for you to do.

  1. Confirm exactly where you are writing the file to. On a shared account, you should ONLY be writing to folders within your path and not trying to use any temporary location.
  2. After doing #1, contact GoDaddy to figure out why you don't have permissions to write to the needed directory.
Mitchel Sellers
A: 

Try using Server.MapPath to get a place to locate your files. If you hardcoded something like "c:\tempdir\website1\tempfile.txt" this won't work because it's shared hosting on GoDaddy.

The Server.MapPath method returns a dynamic file path based on where your root files are located. You should have read/write access to you're root directory on GoDaddy.

Noah