|
I have network access to machines on the domain via remote desktop connection. I am trying to see if there is a way using C# to write an application that allows me to logon to the machine in such a way that it would allow me to check if a process is in memory.
Essentially I am trying to automate the process of checking to see if an executable that is supposed to be running is in fact running on 20 or so different machines without having to use Remote Desktop to login and physically inspect them.
Can someone point me in the right direction if it is possible?
|
|
|
|
|
You can use the Process.GetProcesses()[^] method. This method will use the same credentials as the user than runs your C# application. This user would need to have permissions to list processes on the remote box. In addition, there's a problem[^] with listing processes on certian windows boxes.
You can impersonate another user in C# as described here[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
That's cool. I didn't know Process.GetProcesses could get the processes of a remote machine. I thought it was limited to where the exe was run from. "The More You Know..."
|
|
|
|
|
Hi there, I'm a new bie to C# still learning about it. Everything that i've read about the SET and GET method, I don't seem to understand and understand the purpose of its use and when to use it in an application. I was wondering if some one could help me. Any sample code that I've downloaded using this method so I can debug through it to hopefully understand dosen't work. I'm using .net framework 2.0. I've got some of the following code below that i've adapted to test it. I have a web form with a button and label on it when you click on the button :
DEFAULT.ASPX
protected void Button1_Click(object sender, EventArgs e)
{
int i;
prop iage = new prop();
iage.age = 5;
Label1.Text = iage.age;
}
PROP.CS
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///
/// Summary description for properties
///
public class prop
{
public prop()
{
//
// TODO: Add constructor logic here
//
}
private int age = 0
public int age
{
get
{
return age;
}
set
{
age = value;
}
}
Thankyou
|
|
|
|
|
You can't give the private variable age the same name as the public property age. Consider renaming your private variable to something like _age.
You would have seen this error returned by the compiler though, right?
Regards
Paul
|
|
|
|
|
pmarfleet wrote: Consider renaming your private variable to something like _age.
Consider also sticking to the Microsoft guidelines that say that public properties use Pascal naming convention while private fields use camel case.
|
|
|
|
|
Thankyou Paul, i did get an error stating that your using the property name more than once.
|
|
|
|
|
get/set methods are called properties. They are syntactic sugar to allow you to hide the details of members, and provide the equivalents of methods to retrieve or set the value of those methods. So, what do I mean by this? Well you could view each get/set property as really being two methods; one is set_property and the other one is get_property.
Why would you do this? Well - properties allow you to encapsulate/hide members. Instead of providing you with direct access to the members, properties abstract your access. This means that you can leave implementation details for working with the members. For instance, suppose that you want to ensure that a string is of a certain length then you can do this like:
private string _myString;
public string MyString
{
get { return _myString ; }
set
{
if (value != null && value.Trim().Length > 30)
value = value.Substring(0, 30);
_myString = value;
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thankyou Pete, that is really helpful. So if we use your example above i believe instead of having the if statement in the back of the web form where it can be accessed by anyone and needed to be rewritten for other similar cases we know lock down the access to the data and also reduces the amount of redundant code. Have I correctly understood the purpose of this.
Thankyou
|
|
|
|
|
You have - although it offers more. Suppose that you want to change the length that is allowed - instead of having to search through every piece of code that calls this and change the length there, you can do it in one place here. Also, you can create a simple "dirty" check by doing:
public class MyClass
{
private string _myString = string.Empty;
private int _myInt = 0;
private bool _isDirty = false;
public string MyString
{
get { return _myString ; }
set
{
if (_myString != value)
{
_myString = value;
_isDirty = true;
}
}
}
public int MyInt
{
get { return _myInt; }
set
{
if (_myInt != value)
{
_myInt = value;
_isDirty = true;
}
}
}
public bool IsDirty
{
get { return _isDirty; }
}
public void Save()
{
_isDirty = false;
}
} This is only one example of the type of thing that you can do with properties.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dataset should be saved to the SQL Database.
Am trying to do this using the Application Blocks.
I have downloaded it and am trying to use the SQLHelper class.
Can you tell me if this is a good practice?
How else can I push my dataset into the SQL database. I want to save the entire dataset in a Save_button click and not row by row.
Just a suggestion is enough. I know there are different means to do this but I want to know what is the practice that is generally carried on.
Some advice would really help.
Thanks
____________________________________________________________________________________________________________________________________________________________
"Always forgive your enemies - nothing annoys them so much."
-- modified at 15:15 Monday 24th September, 2007
|
|
|
|
|
You could serialize the contents of your DataSet to XML and write a stored procedure that uses SQLXML to import the contents of the XML document in one go.
For more information about SQLXML, follow this link[^].
Regards
Paul
|
|
|
|
|
Recently i came here to discuss the issue, how to secure files (pdf), the recomendation was httphandelers, it works absolutely great.But now an new issue has been arrived.
What i did , i registerd ISAPI extension (.pdf) in IIS 6.0,to let process the request to ASP.Net runtime, there i used context.response.transmitfile to send the file to the browser, as client will be viewing file in browser not downloading, but in case when file is bigger than 20 MB ,(file can be upto 100MB), it takes time, obviously it should take.
But when we redirect or request pdf file without registering ISAPI extension, browser starts showing file, means you see instantly first page or few pages while other are downloading, how to achive this kind of performance, and this kind of behaviour, with letting asp.net runtime process the request.
I hope you guys get my question & if any explaination needed please ask.
Note: Same issue with uploading files with .Net uploader control, even after we change machine.config file size attribute, i want suggestion about better performance, when many users are doing both uploading, and viewing files from repository.
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Hi everyone,
Could anyone kindly assist with some codes (preferably C#, Java) for the Travelling Salesman Problem that uses any of the following Heuristics
1. Tabu Search
2. Hill Climbing
3. GRASP (Greedy Randomized Adaptive Search Procedure)
4. Simulated Annealing
I need this to just text some problems.
Thanks
laremtj
Jesus Loves You, Give your Heart to Him Today
|
|
|
|
|
You do know that we don't do homework for you don't you? If you need help on these problems, then I suggest you use google to find out more details.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: we don't do homework
And I just barked at him for cross posting, too
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
If you have specific questions about a specific problem you have encountered trying to solve these problems, ask and people will try to help. No one here will simply provide you with a solution.
|
|
|
|
|
see here:[^]
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
That's a great FAQ! Perhaps Pete should update his Forum Guidelines post with some of this info.
|
|
|
|
|
Scott Dorman wrote: Perhaps Pete should update his Forum Guidelines post with some of this info.
It looks like it's time for Forum Guidelines version 2.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Don't cross post (most the same message in multiple forums) in the forums. It is rude, and I had to read this twice now
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Can anyone help me out.
I have a CSV File and i stored it in database table using SqlBulk copy. In the database table i have following fields like Id(PK, Identity), Venue, Cost, Event ant Quantity. This works fine when the CSV file fields come in this same order, in some cases CSV Files have more field and their order is not like the same as table fields so when i try to store i am getting error. Can anyone please help me out how to use mapping concept so when the CSV file order changes or extra fields come, i can take only required feilds. Thanks in Advance.
Jebin
|
|
|
|
|
By "in some cases CSV Files have more field and their order is not like the same as table fields" do you mean that the order changes, or simply that more fields are included on the end?
In the case of records having more fields, you could use File Helpers:
http://www.codeproject.com/csharp/filehelpers.asp[^]
and simply program against a full (complete) recordset.
If, on the other hand, you are suggesting that you recieve multiple formats of csv files that do the same thing, you should a) track down and harangue the person who thought this was a good idea b) See if you can rationalise the formats and make everybody use the same format c) if b isn't possible, see how many formats you are dealing with and if each csv file tells you what format it's in in someway d) use file helpers to build multiple import routines to cater for each csv type.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
Hi, I want to make my windows application like master page. Suppose that when i choose menus then the contents will be shown on the same window.Thanks for advance help.
|
|
|
|
|
I think you have a misunderstanding of what the master page concept is. It does not apply to Windows forms.
only two letters away from being an asset
|
|
|
|