|
Thanks for your reply but it is not clear to me which attributes of ProcessStarInfo has to be supplied with user's login name and password.
Simply, I need running a program with another user's privileges. When I use "runas" DOS command I am prompted to enter the user's password. That's the problem. I don't want to supply the password during runtime. I want the job to be done automatically.
thanks,
|
|
|
|
|
The properties are called UserName and Password . I saw right now that both are new in framework version 2.0 so that's probably the reason why you didn't find them. In case you're using a framework version prior 2.0, there's probably no managed way and you have to p/invoke the unmanaged function mentioned in your first post.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
thanks,
i am using 1.1
|
|
|
|
|
In case you don't already knew it, take a look at http://www.pinvoke.net[^]. It's a great help when you have to work with unmanaged apis.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi all,
I want to check whether computer is connected to the network or not. I use a boolean method IsNetworkConnected() as shown below. I wonder if this method is OK, if not can you suggest any method?
public bool IsNetworkConnected()<br />
{<br />
IPAddress IPAd;<br />
ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());<br />
IPAd = ipHostInfo.AddressList[0];<br />
<br />
if (IPAd.ToString() == "127.0.0.1")<br />
{<br />
return false;<br />
}<br />
else<br />
{<br />
return true;<br />
}<br />
}<br />
|
|
|
|
|
i am sure this method will work.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
It really depends on what you mean by "connected to the network". If you are only interested in determining if the network is available (ie, the cable is plugged in and the NIC is getting a signal) you can use the NetworkAvailabilityChangedEventHandler delegate[^].
Using the AddressList property as you show above isn't the most reliable way to check as it may not return the addresses in the order you are expecting, so AddressList[0] isn't guaranteed to be the loopback address. (The better way to test if it is the loopback address is also to do if (IPAd == IPAddress.Loopback) or if (IPAddress.IsLoopback(IPAd)) .)
If you need to know if you are connected to the internet, the best options are to try to browse to a website or ping a known address.
Using ping:
bool internetAvailable = false;
Ping pinger = new Ping();
PingOptions pingOptions = new PingOptions(1, true);
byte[] pingResults = new byte[2];
PingReply pingReply = pinger.Send("www.microsoft.com", 25000, pingResults, pingOptions);
if (pingReply.Status == IPStatus.Success)
{
internetAvailable = true;
}
Using website:
bool internetAvailable = false;
Uri requestUri = new UriBuilder("http", "www.microsoft.com").Uri;
HttpWebRequest connectivityCheck = WebRequest.Create(requestUri) as HttpWebRequest;
connectivityCheck.Timeout = 25000;
HttpWebResponse connectivityResponse = connectivityCheck.GetResponse() as HttpWebResponse;
if (connectivityResponse.StatusCode == HttpStatusCode.OK)
{
if (!connectivityResponse.IsFromCache)
{
internetAvailable = true;
}
}
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Thank you for your reply, I dont need internet avaliability, but it is useful.
I think I can use NetworkAvailabilityChangedEventHandler, as you wrote. Thanks again;)
|
|
|
|
|
Hi,
is there a workaround for the following problem that occurs on .Net 2.0:
DirectoryInfo di = new DirectoryInfo(@"\\server.sub.domain.net\folder");
FileInfo[] aFiles = di.GetFiles("*.html");
On 1.1 this works fine, but version 2.0 it gives
************** Exception Text **************
System.IO.IOException: The network path was not found.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
If I replace name from UNC path with IP address or "short name" like \\server\, also 2.0 version starts to work.
Is there any fix available for this?
Br,
mjma
|
|
|
|
|
I am a new user to this site. I need to to know that how to convert a database file may be in access or in SQl in to html file.if anybody can help me in this
regards
shriya
|
|
|
|
|
There is no such conversion. An html page is not capable of carrying the kind of information that a database contains.
What is it that you want to do, really?
---
b { font-weight: normal; }
|
|
|
|
|
thnx for ur reply, i ws pretty worried as how to do it. finally when i surfed all the sites n didnt get it then thought for this option. thnk again for ur information
|
|
|
|
|
do u mind if i will put the real scanario of the problem, it may take much time for us.
thnx.
regards
shriya
|
|
|
|
|
Using SqlCommand and DataSet to Insert (Update, Delete) data into Database, which is better ?
How to use DataSet, SqlataAdapter with OOP ?
|
|
|
|
|
u can use SqldataAdapter's update method to update database,for this u have to define proper SqlCommand with proper parameters for inserting,updating or deleting the rows in specific table and then u have to assign these commands to SqldataAdapter's InsertCommand,UpdateCommand and DeleteCommand property.Then
based on the rowstate of table in dataset the appropriate command will be executed automatically by calling SqldataAdapter's update method
rahul
|
|
|
|
|
Hi,
I need to know about any Sliding menu builder for Windows Application. i've found alot of Menu builders but for web applications like AspxLab and MenuLab etc. or does anyone know how to make Siliding menu using C# built in Controls????
Thanks in advance
|
|
|
|
|
I am playing a .wav file in my application i.e running successfully on
Windows 2000 Prof n Windows 2000 Serv. with Framework 2.0
Now I have installed Framework 2.0 on Win 98 and when I try to run the
application its running fine but the .wav file is not running i.e I
cannot hear the sound.
Can any one help to sort out this problem.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hi folks,
I need to record my applications events errors and some details in to the eventog.and i have use the following code to create event log.it write's but i need to read the logs which is my application write.
EventLog.CreateEventSource("PsisLog","PSIS Entry");
EventLog.WriteEntry("PsisLog", str_log);
the PSIS Entry is not in the evevt viewer, the PsisLog is displayed under Application but i want create new event view like application
Anybody face like this problem plz share with me
|
|
|
|
|
Hi, Dear Respected Programmers
Kindly check my following command, where am I doing problem? because following command is not working.
System.Diagnostics.Process.Start("E:\\SQLLDR SCOTT@OCONN/TIGER DATA=TEXTFILE.TXT CONTROL=TT.CTL");
please give me the correct method.
Thank you in advance
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
Dear Guffa!
it is not working without any error message
actualy I need to know real method of mentioned command
Thank you for replying
|
|
|
|
|
There are countless of ways that something can be "not working". What exactly do you mean when you say that it's "not working"?
You have to separate the file name from the arguments when you start the process.
---
b { font-weight: normal; }
|
|
|
|
|
Dear Guffa!
it is not working without any error message
actualy I need to know real method of mentioned command
Thank you for replying
|
|
|
|
|
Process.Start is what you need. What happens when you type that command on the command line ?
Christian Graus - C++ MVP
|
|
|
|
|
actualy i am trying to load some text data into table. when I try following command in VB6 so it is working very good.
VB6 command is => Shell "SQLLDR.EXE SCOTT@OCONN/TIGER DATA=TEXTFILE.TXT CONTROL=TT.CTL ", vbNormalFocus
--------
I think, I do not have correct method to run this mentioned syntax into C#
Thank you very much for your kind considiration
Please help me about said metter
|
|
|
|