|
Hi,
I have a Win Form application (C# Net Framework 3.5) which I try to run on Windows 7. In my local network I set up an AD LDS role to a windows 2008 server. I make an application store by using azman on AD LDS. Define operations, task, roles and roles assignments on it. Using Enterprise Library 5.0 security application block I add an AzMan Authorization Provider to my app.config in Win Form. Here is the properties that I set;
Name: MyProvider
Application:
Application Scope:
Audit Identifier Prefix: W
Store Location: LDAP://WS2008:389/CN=STR2,CN=WS,DC=PW,DC=COM
Type: AzManAuthorizationProvider
In Win Form I code like this..
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
IAuthorizationProvider iAuthorizationProvider = AuthorizationFactory.GetAuthorizationProvider();
bool auth = iAuthorizationProvider.Authorize(principal, "BackUpAdmin");
the last line gives the following error
Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use Microsoft .NET Framework Configuration tool.
I want to understand why .net apply security policy for the code. How could I grant the application for the required permission. Did it relevant only on Client part (Windows 7), did I do anything on Windows 2008 server.
I can reach application store via azman.msc on windows 7...
Please inform and advice me..
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Security.SecurityException: The specified network provider name is invalid. (Exception from HRESULT: 0x800704B4) --->
karanba
modified on Tuesday, June 15, 2010 10:55 AM
|
|
|
|
|
Before anyone will help you you need to cut down on the code dump: just post the fragments that are pertinent to the issue and no more.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|
|
How can i add some properties to Object. or String.
for example i wanna to add <<isnull>> to Object so I can call this property by <<object.isnull>> Or I wanna to add this to String ===> String.IsNull something like :
string.IsNullOrEmpty
object.Equals
Thanks
|
|
|
|
|
|
I want to add property directly to String. OR Object.
Not :
String name = "Ali";
bool IsNullString = name.IsNull();
But I wanna to have this :
String name="Ali";
bool IsNullString = String.IsNull(name);
Or
Object its own self has two properties (object.Equals , object.ReferenceEquals) how can i add IsNull to the object it self
so i can use that something like this :
object obj = "Ali";
bool IsNullObject = object.IsNull(obj);
modified on Tuesday, June 15, 2010 9:03 AM
|
|
|
|
|
why? you don't seem to read the answer anyway.
|
|
|
|
|
I have read the ans ! But I wanna to have this
I want to add property directly to String. OR Object.
Not :
<pre>String name = "Ali";
bool IsNullString = name.IsNull();</pre>
But I wanna to have this :
<pre>String name="Ali";
bool IsNullString = String.IsNull(name);</pre>
Or
Object its own self has two properties <code>(object.Equals , object.ReferenceEquals)</code> how can i add <code>IsNull</code> to the object it self
so i can use that something like this :
<pre>object obj = "Ali";
bool IsNullObject = object.IsNull(obj);</pre>
|
|
|
|
|
I know what it is you want, I did read the question.
I also know you were given the answer, including examples; seems you are failing to either read or recognize it.
|
|
|
|
|
Why would you want to do this when you can just do this:
bool IsNullObject = (obj == null);
The String class already has a method that does something very similar to this, called IsNullOrEmpty.
In any case, you were already given the answer, Extension Methods.
|
|
|
|
|
You have already asked this question. Please use the thread you asked it on rather than starting off a new thread.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
At the risk of repeating what everyone else has said, in both this thread and your previous one....
What you're asking is how to add a static method to an existing class. The answer; you can't. period.
.NET allows you to add extension methods, which are themselves defined in a static class, but operate on an instance of a class, not the (static) class itself.
So, in summary - you cannot do what you are asking.
|
|
|
|
|
So You Say that its not possible to add static items to Object.
|
|
|
|
|
J4amieC wrote: The answer; you can't. period.
That seemed pretty clear to me.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
You're 'special' arn't you?
|
|
|
|
|
so what about this ?(I wanna to do this finally but dont know how to explain my question)
Object obj = null;
if(String.IsNullOrEmpty(obj))
{
}
obj = "";
if(String.IsNullOrEmpty(obj))
{
}
|
|
|
|
|
obj is not a string, so you cannot perform a string.IsNullOrEmpty on it. You need to test it with
if (obj == null) An Empty value is a special conditional value, and differs depending on the type it is appropriate for, so you cannot have a generic IsEmpty method that checks to see if it's empty.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
You can create an extension method as has already been suggested but how do you expect to test for empty?
Unless ToString has been overridden to return string.Empty then obj.ToString() will never be empty.
namespace YourNamespace
{
public static class ExtensionMethods
{
public static bool IsNullOrEmpty(this Object obj)
{
if (obj == null)
return true;
}
}
}
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
it give these errors :
Error 1 Type expected
Error 2 ; expected
Error 3 Invalid token '==' in class, struct, or interface member
declaration
Error 4 Type or namespace definition, or end-of-file expected
Plz Help !!!!!!!!!!!!
|
|
|
|
|
Hello,
How I know Which computer locked my user?? Complicated?
Sombady knows ???
Thank-you.
|
|
|
|
|
You can't find that out. There is nothing in AD that logs or tracks that information.
|
|
|
|
|
Hi friends
I have a c++ dll which contains a class named as CLog. How can i use above class in C# program
thanks in advance
-kk.tvm-
|
|
|
|
|
If the C++ is .NET you can add a reference to the dll to your project and use the class directly.
If not, you will need to wrap it by recreating the functions of the class using the DllImport attribute[^].
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hey
Does anyone know how to view a jpg stored in a stream on a control such as a picturebox without having to first convert it to a BITMAP using Image.FromStream?
Thanx
|
|
|
|
|
why would one want that?
two ways:
1. save the stream to a file, then use Image.FromFile or PictureBox.Location
2. create your own JPEG decoder (the inverse of this[^], i.e. implement Image.FromStream yourself.
It doesn't make much sense to me.
|
|
|
|
|
Maybe I was a bit vague. I am recieving a stream of jpegs from a number of cameras. I want to show these on screen and I was wondering if there was a way of doing this without having to first uncompress the jpg using Image.FromStream as this is a slow process.
|
|
|
|