Click here to Skip to main content
15,885,159 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i can upload one file to ftp server(drive hq).but one exception is occured ..that is


"Unable to cast object of type 'System.Net.HttpWebRequest' to type 'System.Net.FtpWebRequest'."
Posted

1 solution

Simple: don't cast types which are not assignment-compatible. Look at your code and the MSDN help on both classes where it shows inheritance between nearest classes in inheritance tree; then you well see it. If not, learn inheritance, compile-time and runtime types and general typing principles in OOP and .NET.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900