Writing DLLs for Managed Trust Environment

L

Leo

I am in a dilemma. I am creating a managed code library in C# for use
with ASP.NET. The nature of this library requires me to serialize XML,
and therefore access files. However, I get a security exception when I
call the code in the Dll from the ASP.NET file. Here are the two
methods I call:

public void SetUserDataFilePath(string UserDataFilePath)
{
_path = UserDataFilePath;
}

public void CreateUserFile()
{
_txtWriter = new StreamWriter(_path);
_xmlSerializer.Serialize(_txtWriter, _userTree);
_txtWriter.Close();

}

Now, here is the code i call from the ASP file.

EnterpriseAuthentication ea = new EnterpriseAuthentication();
ea.SetUserDataFilePath("users.xml");
ea.CreateUserFile(); **THIS IS THE LINE THAT THROWS THE
EXCEPTION.

Although I am only pointing to a file within my Application's virtual
directory, it still throws the exception. Please help! I need for my
DLL to be able to access files withing my App's virtual directory.

Thanks, all!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top