Wednesday, June 11, 2008
Access UNC file share with credentials
An easier way I figured to work around this is to login to the server using the local account that runs the job. Map the UNC file folder to a drive; when windows prompted for credentials, used a valid network account and made sure to reconnect at logon. Well, there you go! It seems to work for me. Don’t know if there’s a better ways to do it but this is simple enough to let it work for now.
Love coding!
UPDATE 07/21/2008:
Well, found a better way :-) Just use Net command to set the connection credentials. For Example,
net use \\MyServer\D /user:domain\myUserID MyPassword
XCopy ....
It works!
Friday, June 6, 2008
Passing credentials to URL - when reading content from a url using System.Net namespace
// Using System.Net.WebClient
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential("userName", "password");
// I set my proxy with webProxy method and use it if needed
//webClient.Proxy = this.webProxy;
using (Stream stream = webClient.OpenRead(url))
{
using (StreamReader reader = new StreamReader(stream))
{
string response = reader.ReadToEnd();
return response;
}
}
// Using System.Net.HttpWebRequest
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Credentials = new NetworkCredential("userName", "password");
// I set my proxy with webProxy method and use it if needed
//request.Proxy = this.webProxy;
using (Stream stream = request.GetResponse().GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
string response = reader.ReadToEnd();
return response;
}
Love coding!
Thursday, June 5, 2008
Visual Studio 2008 & Crystal Reports Redistributable package
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5
Love coding!