Click here to Skip to main content
15,893,904 members

Comments by EricFowler (Top 9 by date)

EricFowler 16-Apr-11 15:06pm View    
This was the correct answer. It works now. Thank you for your assistance.

Eric
EricFowler 16-Apr-11 4:23am View    
Yeah - but they specifically granted OleDbPermission and OdbcPermission on the host. I want to do this:
protected void Page_Load(object sender, EventArgs e)
{
string sName = "~//mydata//myfile.txt";
StreamWriter w = File.CreateText(sName);
w.Close();
}
EricFowler 16-Apr-11 2:58am View    
Here is some info from my host:

"Trust level refers to permissions set in the Web.config file that dictate what operations can and cannot be performed by Web applications. Our ASP.NET 3.5 and 4.0 shared hosting servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission[this explains why the user information db works in App_Data], and a less-restrictive WebPermission.

Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use ReflectionPermission (but can use Reflection). Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy.

Using a Medium trust level prevents applications from accessing shared system resources and eliminates the potential for application interference. Adding OleDbPermission and OdbcPermission allows applications to use those data providers to access databases. WebPermission is modified to allow outbound http and https traffic."

So what is the 'virtual directory heirarchy'? I have created another directory in their control panel and given in the right perms but no joy in Mudville.
EricFowler 5-Apr-11 17:41pm View    
And I should add that when I have one item in the list, and I call foo(), the list item changes value before I add the second item to the list. So the memory is hanging around and being reused by foo(). But I am not clear why this would work in C# console app and fail in ASP.
EricFowler 5-Apr-11 17:39pm View    
From the original post:

"So I am populating a list of unique 'things' by calling a fxn.

When I run as a console app in C#, all works as I would expect: I get a list of 'things' with x = 0,1,2 ... etc.

When I call the same assembly from ASP.Net, with this code embedded in a web page, I get a list of 'things' with x always set to the last value in the array. In other words, the assembly seems to save a reference to the object and overwrites early values with late ones.

....

The Big Question is, why is this different in ASP vs. C#?"