|
I have to Impersonate my windowsApplication (C#) to the Credential (which will be send by user).. Give below is my same function (Which wont work) what i need.
public class clsImpersonate{
public void Impersonate(ICredential UserCredential){
WindowsIdentity newId = (WindowsIdentity)UserCredential;
WindowsImpersonationContext impersonatedUser = newId.Impersonate();
MessageBox.Show(WindowsIdentity.GetCurrent().Name);
}
}
I will call the function like below..
public static void mail(){
clsImpersonate objImp = new clsImpersonate();
ICredentials NWC = System.Net.CredentialCache.DefaultCredentials;
objImp.Impersonate(NWC);
}
But above code is wrong because we can not typecast from Icredential to WinndowsIdentity.
Is there any other way to do the same.
Thanks
Saravanakumar.K
India
|
|
|
|
|
How will the runtime allocate memory for a string if the same variable is allotted different values in a block of code.
For example:
{
string str = “value1”
.
.
.
.
str = “value2”
}
In the above case, when str=”value” is done, memory is allotted to str and “value1” is stored. Again, when “value2” is allotted to the same variable, is a new memory block allotted or will the value “value2” replace the value “value1” in the current memory block?
Please Help.
|
|
|
|
|
Strings in .NET are immutable. That means that a string value is never ever changed.
If you assign a new string value to a variable, the new string value is stored at a different location and the variable is changed to reference that location.
Another example:
str = "asdf";
str = str.ToUpper();
The ToUpper method will create a new string and return the reference to it. The original string is never changed, the variable is just changed to reference the new string.
---
b { font-weight: normal; }
|
|
|
|
|
hm Very interesting!
and what about integers and doubles. Are they treated the same way?
One more question....what would be the advantage behind allocating separate space to strings everytime you update them and changing the reference.
Thanx in advance
Regards
mubashir
|
|
|
|
|
_mubashir wrote: and what about integers and doubles. Are they treated the same way?
No. They are value types, not reference types.
_mubashir wrote: One more question....what would be the advantage behind allocating separate space to strings everytime you update them and changing the reference.
The advantage is that whenever you use a string you only send the reference instead of copying the entire string. If you would copy the contents of the string every time you assign a string or use it in a method call, there would be a whole lot of copying.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
I am very new to .net programming and doing alot of reading but am getting a bit list with some of the terminologies. Could somebody explain the building blocks of .net programming eg: objects, classes, methods etc etc.
All responses will be gratefully accepted.
csp
|
|
|
|
|
Hi
There are somany thing in that case...
tell me which one you are looking....
Chinna Srihari
Tech Lead, Capgemini
|
|
|
|
|
Hi Chinna,
Thankyou very much for answering my post. I am just starting to teach myself .NET programming. I have taught myself basic programming, but wish to channel all my studies in to .NET. I am at the very beginning and was hoping that somebody would be able to give me an application diagram or something similar which would show me the concepts of object oriented programming eg: how classes, objects, methods, functions, enumerations, interfaces etc etc all fit in together.
Hopefully this is making sense. As I mentioned I am right at the beginning of my studies but this is something that I really want to devote alot of time to, and I will keep on reading but am hoping somebody can give a clear picture of how an application all fits together.
Much appreciated.
Craig.
csp
|
|
|
|
|
My suggestion: Don't start off trying to learn the .NET hierachy. It's huge.
Learn in small chunks.
Start by learning from a good book on OO techniques. I'm afraid all my basic reference works are out of date, but I'm sure a search in Amazon or Google will help. Look for books that have several *independent* good reviews.
Learn the basic principles of encapsulation and data hiding, inheritance and abstraction. Understand what is meant by "Design by Contract".
Don't go into multiple inheritance - it's a minefield, and not supported in .NET anyway.
Learn about the failings of OO too: where it doesn't work as where it does. For example, that mututally dependent objects can cause unwanted side effects. It's harder to find info about where/why OO doesn't work because it's not "cool", but it is useful to know, all the same.
Although not all directly relevant, books like "The Mythical Man Month", "extreme .NET" (Roodyn), "Microsoft Secrets", and "Classical and Object Oriented Software Engineering" (Scach) might be of interest.
HTH,
Ruth
Ruth Ivimey-Cook
VS2005 / C# & VB
|
|
|
|
|
Hi
before you are going through the .NET syntax and other .NET stuff. You should understand OOPs concept. There are lot of website describe the OOPs in better manner.
Once you understand the OOPs then you will get answers for your maximum number of question.
Thanks
Saravanakumar.K
Saravanakumar.K
Tokyo
|
|
|
|
|
Thanks for replying to my post Saravanakumar.K
I am right at the beginning of my studies. Could you suggest some links for beginners to OOP
Thanks in advance
Craig
csp
|
|
|
|
|
Hi
There are many websites are describing OOPs Concept, below link explain the OOPs with .NET as example
http://www.c-sharpcorner.com/Code/2005/June/OOPSand.NET2.asp
You can find many other OOPs tutorial by searching Google
Thanks
Saravanakumar.K
Saravanakumar.K
Tokyo
|
|
|
|
|
I am new to Biztalk Server and am having difficulty. I was able to do a project.Build and deployment were successful. Where I run in to difficulty is when testing When I drop the file in the in File folder - it leaves immediatley, but never appears in the out folder. Please provide me with some troubleshooting tips. I have checked the ports, all appear ok and are up and running. When I look at the BizTalkmgtDatabase I see entries in the receive and send tables, but the message never appears. Please provide help ASAP.
Heather
|
|
|
|
|
Hi ,
Can any one please let me know how can i use the vc++ code in c# using the concept of Managed and Unmanaged code?
Bcoz i dot have any idea about the interface so please suggest me about how i can go ahead.
Thanks
|
|
|
|
|
Yes, if your new to this i would start simple. For my final project at uni i had to wrap an old C++ header file to .net. It was very tricky, but not imposible!
First have a google at wrapping C++ into .net, and get round the concept of IJW (it just works) that try a basic C++ concole app first in MC++ to wrap it into .net!
your first example wants to be simple, then move on to pinning parameters, this is a bit complex.
good luck
andy
|
|
|
|
|
I heard on the MS parnetship sites that the VS2005 service pack 1 was shipping next week. But, the public potion of MS says Q3.
Does anyone know the truth?
I heard it has edit and continue for c#, so I can't wait.
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
What do you mean with "Edit and Continue"? I assumed it just meant you could change the code from the debugger and continue execution of the modified code directly. But since this is already available for C# in VS2005 without any service pack, you must be referring to something else?
|
|
|
|
|
It doesn't work for me. Is there a setting?
It barks at me if I try and continue. On the partnership sites it says ts not available till q03.
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
..its defintely in. I use it all the time. Had an idea that the service pack isn't out for quite a while yet, which is a pity as there's quite a few issues which need addressing.
Tools->Options, Debugging->Edit and Continue->Enable Edit and Continue.
Regards,
Rob Philpott.
|
|
|
|
|
I don't have the Debugging section in Tools->Options.
Although I have the VB setup because I like the VB shortcuts better. Is that an Issue?
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
As far as I'm aware it's due in q3. However, VS 2003 SP1 should be due any time now. Maybe that's what the confusion is?
Kevin
|
|
|
|
|
We have used one listbox in windows form and we bind it with datasource from database.
Listbox allows multiple selected.
How can we retrive value of selected items from the list box??
we tried following thing
for(int i=0;i
|
|
|
|
|
What do you think is the selected value?
You filled the list with a DataView (which is a set of DataRowViews), so SelectedItems[n] returns the selected DataRowView.
I hope you have already tried that:
MessageBox.Show( ((DataRowView)lstEducation.SelectedItems[i])[0].ToString() )
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Thanks lot,
It works, Thank you very much.
Please give me link of ur blog if u r writing
Nilesh Gambhava
Nilesh Gambhava,
Life is NP-Complete so don't use Algorithm but use Heuristics
|
|
|
|
|
Along with the first post you can also set the DisplayMember and ValueMemeber to the column names you would like to display and key off of.
-Richard
|
|
|
|