|
Non-specific questions like these are best answered by reading the .NET Framework SDK, specifically sections like Employing XML in the .NET Framework[^]. This sections includes many topical articles, examples, and links to class library documentation which is very important to read.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
We have problems with two software packages. Both packages require the .NET framework be installed. Both vendors software works great for the ADMIN, but both throw exceptions for users that are not ADMIN.
Can you point me in the right direction?
thanks
|
|
|
|
|
I'm pretty sure your program tries to do something which is denied by the OS and as a result the exception is thrown.
It would be helpful to know which exceptions are thrown and even more important which operations caused them.
www.troschuetz.de
|
|
|
|
|
|
Can you point me in the right direction?
Another vendor? Unless you specifically need the applications to do admin-type things, it is inexcusable for commercial .NET software to require admin rights.
my blog
|
|
|
|
|
It's inexcusable for any application to require admin rights if, indeed, it doesn't require them (i.e., a system management package would most likely require admin rights, and justly so).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Because software must be careful about requiring admin privileges (for example, why should calc.exe require admin privileges), you must be careful about using features that require admin privileges. This includes writing user preferences or data to protected registry hives (like HKEY_LOCAL_MACHINE) or directories (like %WINDIR%), and many more.
If, at times, your software requires admin privileges, either be prepared to catch SecurityException or similar exceptions (the BCL method documentation should state what could be thrown), or use Code Access Security (CAS) - namely the PrincipalPermission , to either declaratively or imperatively demand permissions with a certain group.
A good starting point to learn CAS is Understanding .NET Code Access Security[^] right here on CodeProject. Be sure to follow the links.
So, if you had a method that required Admin privileges (say to enumerate a certain protected DC in Active Directory), you could code your method like so:
[PrincipalPermission(SecurityAction.Demand, Role="Administrators")]
public IEnumerator GetADEnumerator(string path)
{
} Do note that using the PrincipalPermissionAttribute or PrincipalPermission (for declarative security) does require to either hard-code a domain name (i.e., "MYDOMAIN\Domain Admins") or to use a local group where a domain or machine name isn't required).
In these cases, catch exceptions is a better choice (and should be done anyway since calling a protected method using CAS will still throw an exception).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello! I'm using a listView to display some objects and i have in each row a checkbox control. I want to remove the selection of one item so that the only control selection on the listview is the checkbox. I another way i want the item doesn't turn blue when selected and the only way of selection is the checkbox.
Thanks !!
Bruno Conde
|
|
|
|
|
hi,
Lot of article are there in codeproject which help you to play with listview.
I can give an exact match for you. Please check this url for your purpose.
http://www.codeproject.com/listctrl/supergrid.asp
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I have an app with a few forms all of which can be opened at the same time. From the starting form a blocking socket class is initialised in a new thread, and this class raises different data received events handled by the different forms depending on the data received.
The problem is one form adds the data to a datagrid and whenever this event is consumed this form comes to the front. this does not happen with the other forms.
So the question is why does this happen and how can I stop it?
|
|
|
|
|
hi,
You can check the property TopMost property of you form. Check it's status.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Top most is set to false, and I don't change it in code.
But thanks for the suggestion, it rules something out.
|
|
|
|
|
hi,
generall we should use process attach tools when debuging service program,
but it's not always available.
could i write some extra code to enter into service main procedure directly,
so i can gain some more debug information.
|
|
|
|
|
Sure,
a log file comes to mind.
Or writing to the event log (but then the messages shouldn't be too long).
Regards,
mav
|
|
|
|
|
i want to delete selected row by pressing delete button on keyboard ...also i want to know the evet when deleteing row on datagrid ...
|
|
|
|
|
hi,
You can't delete a row from datagrid( datagrid row). What you can do is, when user hit the delete key then can delete one record from the data source ( Datatable or view) which use to show the data in datagrid and then you need to re define the datagrid's datasource.
Write your logic in datagrids keydown event.
if(e.KeyValue== Keys.Delete)
{
}
Better if you go through Datagrid HitInfo or HitTestInfo methods.;)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I want to serialize a private field of a class:
...
private ArrayList items = null;
...
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
TextWriter writer = new StreamWriter(path);
serializer.Serialize(writer, this);
writer.Close();
the items array is serialized only if change it to public, but I do not want to do this.
items are presented by the class through some properties, each making some work before
returns something; the basic form of items should not be visible.
Any solution?
|
|
|
|
|
I'm not sure why you're using the XML serializer for this, but here goes...
XML serialization is not designed to access private class members. If you want to force XML serialization to store private class mambers, you may be able to do so using the IXmlSerializable interface see here[^] for a little more info.
If XML serialization is not a requirement, you might consider binary serialization. There's much better support for customizing the serialization process built into the framework (and documented).
Good luck.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I choose XML serialization because I need a text file, which can be edited if needed. If other methods give me a text format it would be OK.
|
|
|
|
|
When I try printing line contains "\t" tab the printer is not printing it, Why and what's the solution?
Thanx.
Devil Linux
|
|
|
|
|
hi,
You can refer this aricle and it is good enogh to print string in C#.
http://www.c-sharpcorner.com/winforms/texteditor.asp
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi,
I got your reply. After getting the entire content (printing content) we are assigning it to the PrintDocument component.
printDocu.Document=this.richtext.text
This point of time the PrintDocument component will treat the entire content as printing content.
In this situation if you try to use \t or \n it will treat as printing characters and nothing else.
The reason is simple there is no direct relation between our printer and CLR. Onece you give this \t or \n then our CLR know what to do once it's found that sort of carriages.
But it is mot applicable with printer (upto my level best ).
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I can get my local IPv6 address in Win2003 use the source code as below:
string localName = Dns.GetHostName();
string address = "";
string scopeId = "";
IPHostEntry hostEntry = Dns.Resolve( localName );
foreach (IPAddress curAdd in hostEntry.AddressList)
{
if(curAdd.AddressFamily.ToString() == ProtocolFamily.InterNetworkV6.ToString())
{
scopeId = curAdd.ScopeId.ToString();
address = curAdd.ToString();
break;
}
}
Then, I set the config about IPv6 in WinXP as the same as Win2003. when I run the source code in WinXP, I can only get the loopback(::1) address but not local IPv6 address.
Thank you for your help!
|
|
|
|
|
|
thank you .
Here is my sequence to setup IPv6 in WinXP:
1、Open the propertiy of local connection, add the McroSoft IPv6 protocol
2、Start a command prompt window and type "ipv6 install"(Window XP).Then I check this by typing "ipconfig/all" at the command prompt, IPv6 address OK
3、Open the machine.config file that is located in the .NET Framework CONFIG directory (on Windows XP it is located at
C:\Windows\Microsoft.NET\Framework\v1.1.XXXX\CONFIG) . Change the XML tag:
to:
<ipv6 enabled="true">
This allows the framework to parse and resolve IPv6 addresses.
DNS need setup in my PC?
|
|
|
|