PC Review


Reply
Thread Tools Rate Thread

Code Access Security exception in subproject

 
 
DC
Guest
Posts: n/a
 
      17th Feb 2005
Hi,

I have a solution with an ASP.NET project and a business and a data
layer in separate projects. The following code

string test = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

runs fine in the ASP.NET app and in the business layer, but throws a
security exception in the data layer. I don't know what's different in
the data layer, after all I did not specify any CAS rules or the like.
There is also no app.config for the datalayer.

Where else could this CAS rule be specified? Thanks for any hint!

Regards

DC
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      17th Feb 2005
DC,

Can you give more details about the exception? Also, are these
libraries, or are you making calls through remoting, or into Enterprise
Services?

--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"DC" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a solution with an ASP.NET project and a business and a data
> layer in separate projects. The following code
>
> string test = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
>
> runs fine in the ASP.NET app and in the business layer, but throws a
> security exception in the data layer. I don't know what's different in
> the data layer, after all I did not specify any CAS rules or the like.
> There is also no app.config for the datalayer.
>
> Where else could this CAS rule be specified? Thanks for any hint!
>
> Regards
>
> DC



 
Reply With Quote
 
DC
Guest
Posts: n/a
 
      18th Feb 2005
Thank you for your attention, Nicholas. It is a SecurityException in
mscorlib:

Request for the permission of
type System.Net.WebPermission, System, Version=1.0.5000.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.

I narrowed the problem; it actually has nothing to do with the
business or data layer. I am loading a webcontrol into a
webusercontrol (ascx) file. When I execute this:

System.Diagnostics.Process.GetCurrentProcess()

in the command window, I receive the exception in any method of the
webcontrol (while it is still working in the ascx file).

I have tried to reproduce the problem by creating a new web project
with a webcontrol library but I failed to get this exception. I have
checked that this new test web does have the exact same permissioning
and I am totally in the dark about why my CAS level "drops" within the
webcontrol. Since I have to do some refactoring anyhow, I will
recreate the project and hopefully not see the exception anymore.

However, it would be good to know what could cause the CAS level to
drop. I am not doing any fancy stuff like loading ressources from a
different web or machine. I ran into this problem, since I am trying
to use Enterprise Library V1.0 which obviously requires the highest
CAS level because it needs the current process name for its
performance counters.

Best regards
DC





"Nicholas Paldino [.NET/C# MVP]" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> DC,
>
> Can you give more details about the exception? Also, are these
> libraries, or are you making calls through remoting, or into Enterprise
> Services?
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - (E-Mail Removed)
>
> "DC" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I have a solution with an ASP.NET project and a business and a data
> > layer in separate projects. The following code
> >
> > string test = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
> >
> > runs fine in the ASP.NET app and in the business layer, but throws a
> > security exception in the data layer. I don't know what's different in
> > the data layer, after all I did not specify any CAS rules or the like.
> > There is also no app.config for the datalayer.
> >
> > Where else could this CAS rule be specified? Thanks for any hint!
> >
> > Regards
> >
> > DC

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About Application Security(Code Access Security). It dosn't show correct output Tony Johansson Microsoft C# .NET 3 14th Apr 2010 03:44 PM
Why i am getting System.Security exception with RSS feed code Showjumper Microsoft ASP .NET 1 8th Oct 2008 03:05 AM
Security Exception thrown from non-executed code? WHY WHY WHY??? Kelvin Microsoft Dot NET Framework Forms 1 14th Oct 2004 04:54 AM
RE: security exception - access denied Tian Min Huang Microsoft ASP .NET 0 7th Aug 2003 05:12 PM
RE: security exception - access denied Tian Min Huang Microsoft ASP .NET 0 30th Jul 2003 11:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.