|
I am working on windows application with c#.net .
I am using FTPwebreuqest class for upload file on ftp.it works fine when there is no proxy between application and internet. but it doesn't work in proxy.
FtpWebRequest reqFTP;
if i use reqFTP.Proxy=new webproxy("proxyservername",port);
then it will display error message "FTP command doen't support in HTTP proxy".
my code is like this
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create("ftp://uri");
reqFTP.Credentials = new NetworkCredential("username", "pwd");
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.UsePassive = true;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
prbUpload.Value += contentLen;
}
strm.Close();
fs.Close();
Any one help me about proxy settings in FTPwebrequest
Pritesh Patel
|
|
|
|
|
Hello,
I've got an application that needs to create 2 remote object (CAO type), I init them into businness logic level:
<br />
private void InitNetRemotingProxy()<br />
{<br />
myDataProxyAccess = new ProxyDataAccess(idCup, idSeason, idMatchCode);<br />
myDataProxyAccess.InitNetRemotingClient("Normal");<br />
<br />
myDataProxyAccessForLev1 = new ProxyDataAccess(idCup, idSeason, idMatchCode);<br />
myDataProxyAccess.InitNetRemotingClient("Lev1");<br />
}<br />
and here's where the init is done
<br />
public void InitNetRemotingClient(string type)<br />
{<br />
string remotingConnection = system.Configuration.ConfigurationManager.AppSettings["serverAddress"];<br />
string tcpPort = (type!="Lev1") ? System.Configuration.ConfigurationManager.AppSettings["tcpPort"] : System.Configuration.ConfigurationManager.AppSettings["tcpPortLev1Stat"];<br />
<br />
string requestService = (type != "Lev1")<br />
? System.Configuration.ConfigurationManager.AppSettings["requestServiceName"]<br />
: System.Configuration.ConfigurationManager.AppSettings["requestServiceName2"];<br />
string sb = String.Format("tcp://{0}:{1}/{2}", remotingConnection, tcpPort, requestService);<br />
<br />
<br />
try<br />
{<br />
RemotingConfiguration.IsRemotelyActivatedClientType(typeof(DBHelper));<br />
<br />
IChannel ic = new TcpChannel(Convert.ToInt32(tcpPort));<br />
int i = 0;<br />
<br />
ChannelServices.RegisterChannel(ic, false);<br />
RemotingConfiguration.RegisterActivatedClientType(typeof(DBHelper), sb);<br />
<br />
myDBHelper = new DBHelper(idCup, idSeason, idMatchCode);<br />
}
on the second call, the one myDataProxyAccess.InitNetRemotingClient("Lev1"); I get an exception at ChannelServices.RegisterChannel(ic, false);, the exception is : Message = "The channel 'tcp' is already registered.".
It's not possible to create 2 channel? Where I do wrong? The tcpport and requestServiceName are different for the two calls.
Please help me, thanks
Bests
Paolo Ponzano
|
|
|
|
|
I've fixed it, I've used:
IDictionary pros = new Hashtable();<br />
pros["port"] = tcpPort;<br />
pros["name"] = type;<br />
<br />
IChannel ic = new TcpChannel(pros, null, null);
and I had to substitute RemotingConfiguration.RegisterActivatedClientType(typeof(DBHelper), sb); with RemotingServices.Connect(typeof (DBHelper), sb);
Seems to work, do you know if there's still something I've to do?
Thanks
|
|
|
|
|
Hello ,
I want to develop one windowsService application in c# for blocking when im opening the watever drive files ,so wat is the FileSystemWatcher event i have to use.
And also i developed windowsService appn to block(delete) the newly created .txt file and i done it successfully.
-- modified at 14:28 Friday 26th October, 2007
|
|
|
|
|
Hi,
I have developed an user contol in C#.NET 2.0 and this control uses MSHTML.dll COM library. Now, how will I know if this control will run on x64 platform. Moreover, what should I do in onder to make it portable for x64 platform ?
Regards
|
|
|
|
|
bashiwala wrote: what should I do in onder to make it portable for x64 platform ?
Change platform target from AnyCPU -> X64 which will compile application in X64. I think it's only available with .NET 2.0. I think the only difference will be large stacks are used in X64 mode by the compiler.
|
|
|
|
|
HI,
Thanks a lot for your help. Will there be any issue if my control depends on a COM dll ? I used MSHTML.dll and I dont know if this dll will run on x64 platform.
Regards
|
|
|
|
|
bashiwala wrote: Will there be any issue if my control depends on a COM dll
Sorry I don't have much idea on this
|
|
|
|
|
Hi,
I have a Windows form with a button on it. I have enabled the HelpButton property of the form and I have implemented the HelpRequested event for the button.
Everything works fine as long as the button stays enabled. When disabled, the contextual help request simply doesn't work.
Is there any workaround for this behaviour? Is it supposed to be by design?
"you can't always get what you want"rechi
|
|
|
|
|
Bogdan Rechi wrote: Everything works fine as long as the button stays enabled. When disabled, the contextual help request simply doesn't work.
I tried this and it worked for me. How the help button is disabled ?
|
|
|
|
|
Thank you for the answer.
Just set the Enabled property of the button to false...
"la dolce ossessione degli ultimi suoi giorni tristi,
Venezia, la vende ai turisti" rechi
|
|
|
|
|
Yes it fired the events in disabled mode too. I think you are missing something.
|
|
|
|
|
I have no idea
Are you using the 2.0 Framework?
"la dolce ossessione degli ultimi suoi giorni tristi,
Venezia, la vende ai turisti" rechi
|
|
|
|
|
No 1.1 . How come you came to know that it's not working ? Can you show me the helprequested event code ?
|
|
|
|
|
There is nothing special with the case:
private void button1_HelpRequested(object sender, HelpEventArgs hlpevent)
{
MessageBox.Show("ok");
}
this.button1.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.button1_HelpRequested);
I tested it on both of the frameworks (1.1 and 2.0) and still with the same result.
"la dolce ossessione degli ultimi suoi giorni tristi,
Venezia, la vende ai turisti" rechi
|
|
|
|
|
It's firing form's help event even though it's disabled. But it's not firing button's help event when it is disabled. I came to know that this is the default behavior.
|
|
|
|
|
OK, thank you.
It's better this way rather than not firing anything at all...
"la dolce ossessione degli ultimi suoi giorni tristi,
Venezia, la vende ai turisti" rechi
|
|
|
|
|
just wondering if someone has implemented something that calculates the TotalMonths (or Weeks or Years) between two DateTime values. The TimeSpan class obviously provides things like TotalDays, TotalMinutes and the like but as it doesn't have any reference to a DateTime it can't give you the TotalMonths, TotalWeeks or TotalYears.
has anyone done that already?
|
|
|
|
|
It doesn't probably because "month" is rather ambiguous. Is it 28 days if the starting date fall in Feb, or the ending date fall in Feb? Or Feb is in the middle of the data range? Probably the same for "Year". How about leap years?
For weeks, you can divide total days by 7.
|
|
|
|
|
just discovered that the (VB.NET) DateAndTime class has a method called DateDiff which calculates such things...
|
|
|
|
|
Hi,
I want to develop an application in C# to access the remote computer like VNC, Remote Desktop Capture. I would like to know how to start to develop such type of application. Please give me some useful link or document or source code for initial starting.
Regards
Rajesh
rajesh
|
|
|
|
|
Initilay u can start with simple socket programing. try to use client server programm . After that start with capturing a single image on client system, by accessing Printscreen keboard port and try to display it your own system say in a picture box.....
in this way u can move on..
Good luck !!!
|
|
|
|
|
start the remote desktop process mstsc.exe through Process.startInfo
Koushik
|
|
|
|
|
He, wants to devloped an aplication like VNC viewe, that he can get's all the control of client system, but if he use remote desktop connection , client system automatically logged of [ xp] and for windows server he has to use mstsc/console to open a separate windows .
but this is not his objective.
He want to bulids a application.
|
|
|
|
|
hi, did u find the solution? i have u're same problem, if so what did u do ?
|
|
|
|