|
Hi,
I want to upload browsed file to the ftp server but getting this error
Sub UploadFile()
Try
Dim fileName As String = FulFile.PostedFile.FileName
Dim requestFTP As WebRequest = WebRequest.Create("ftp://...................." & fileName)
requestFTP.Credentials = New NetworkCredential("userid", "password")
requestFTP.Method = WebRequestMethods.Ftp.UploadFile
Dim fStream As FileStream = FulFile.PostedFile.InputStream 'Error:Unable to cast object of type 'System.Web.HttpInputStream' to type 'System.IO.FileStream'.
Dim bufferLength As Integer = 2048
Dim buffer As Byte() = New Byte(bufferLength - 1) {}
Dim uploadStream As Stream = requestFTP.GetRequestStream()
Dim contentLength As Integer = fStream.Read(buffer, 0, bufferLength)
While contentLength <> 0
uploadStream.Write(buffer, 0, contentLength)
contentLength = fStream.Read(buffer, 0, bufferLength)
End While
uploadStream.Close()
fStream.Close()
requestFTP = Nothing
LblMsg.Text = "File Uploading Is SuccessFull..."
Catch ep As Exception
LblMsg.Text = ep.Message
End Try
End Sub
|
|
|
|
|
I'm not sure how the error message could be any clearer:
- the
HttpPostedFile.InputStream property is a System.Web.HttpInputStream , which inherits from System.IO.Stream ; - you are attempting to store it in a variable of type
System.IO.FileStream , which is a different type of System.IO.Stream .
Change your fStream variable to be a System.IO.Stream :
Dim fStream As Stream = FulFile.PostedFile.InputStream
Also, you're still not calling the GetResponse method on your requestFTP object. If you don't call that method, your request will never be sent.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
GetResponse and requestFTP what are these and how can we upload using GetResponse and requestFTP
bcoz it showing that
Network Error (tcp_error)
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
|
|
|
|
|
requestFTP is a variable in the code you just posted.
GetResponse is a method on the FtpWebRequest type.
The error you keep posting to different threads is most likely related to a timeout or firewall issue, and is nothing to do with the question you asked in the first post of this thread.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have created a basic wcf service nothing more complicated than helloworld. I have tested it with both WCF Test Client and my own client app and it works fine.
So with that I wanted to add a method to it to see if I might try something a bit more complicated. However now when I try to debug using the WCF Test Client my new method doesnt show up the only method that is there is the original one. So I tried removing the original method completely and test again and it is still there and my new method is still missing.
So it is apparent that my modified service isn't updating whatever the WCF Test Client is using to test against.
Where are the temporary files that VS 2008 generates to allow the WCF Test Client to work. Or could someone explain to me how to refresh the service when I modify it.
|
|
|
|
|
Did you add your method to the Interface, or just the implementation? All WCF Clients use the interface to determine what methods are available.
|
|
|
|
|
Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
i am getting this error after uploaded my application on server. The same application works fine on local.i have used vs 2010,asp.net for the same
|
|
|
|
|
Is the AjaxControlToolkit.dll in the bin directory after you deploy the site?
|
|
|
|
|
you need to update the .Net framework on the server. see on the properties of your project whatever version you are using. as you was able to deploy the app, i suppose your project uses at least the same version of .net that the 'AjaxControlToolkit' uses, that's probably 4.0.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
I've a big project with more than 15 module and there are 100 of window.showModalDialog() popup I used. I dont wanna develope one by one popup for close by ESC key. Is there any solution where i'll change or add in a single place and the effect will be whole project. Please tell if you know any solution.
Technology i used. Asp.net 2008, Jquery, Ajax.net, Framework 3.5.
I've attach my popup code also so that it might be helpful for visitor.
Thanks.
|
|
|
|
|
(you popup code will not show if you don't encode it)
if all your popups have a MasterPage, then you can include javascript to close the popup there, if they don't, then you will need to manually include code on all of them.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Hello people !
I am trying to create a website which will allow users to register, log in, change password, etc.
Currently i am creating the register process, and i am doing this by using a custom CreateUserWizard in order to avoid the default buttons that is inserts.
I have successfully created the custom CreateUserWizardStep and when i run the page from VS 2010, i see all the controls on the webpage, that is, Username, email, password, etc textbox-controls.
I didn't want to use the default Create User button that the CreateUserWizard control inserts, and so i put an asp button with ID="Next" Text=Create User and CommandName=MoveNext
Note that I still haven't written code to store the user's credentials in the database yet. I don't want to do that yet.
I also have created the CompleteWizardStep,which follows the CreateUserWizardStep, containing an asp Literal saying that the account was created successfully, when the account will be created, that is when i will also implement the storing of user's credentials into the database that i have created, cause i don't want to use the default one that the .NET framework provides. I will use SQLMembership Provider, but my own database.
When i click the Create User button (i remind that is not the default button of the CreateUserWizard , but an asp button that i inserted), the message in the CompleteWizardStep control doesn't show up at all on the browser. So i assumed that the CompleteWizardStep control is not working.
And my question is why is this happening?
Is it because i haven't implemented yet the storing of data into the database and that way the CreateUserWizard control detects this fact and doesn't move to the CompleteWizardStep ?
If so, how the CreateUserWizard control detects that the data were stored successfully into the databse?
Shouldn't the CompleteWizardStep control run immediately after the Create User button is clicked?
If not so, what am i doing wrong?
If you need code sample i can provide it, but i didn't do so because this is more like a general question i am putting here.
Thank you in advance !
|
|
|
|
|
I thought Microsoft pulled that control out of Visual Studio after VS2005
I haven't used it since 2005, that was 8 years ago, it was a bad idea, and hard to understand. There wasn't much customization that you can do with it.
I can't tell you why it doesn't work anymore. Controls like that require completion first and testing, and then you can try changing 1 thing at a time, small changes, or vice versus.
You can create a new one, and try changing the button again, and try to figure out why it doesn't work. Your probably just missing an attribute in teh button object, Text="Next"
99.9999% of us don't use that control anymore.
|
|
|
|
|
I am uploading 500 MB File on the webserver but it gives message that your file submitted but it does not actually does not upload. How can I increase the time to execute a statement?
|
|
|
|
|
Hi,
Firstly it's not the execution time that is going wrong. ASP.NET websites deliberately restrict the size of file that can be uploaded, and the amount of time the upload takes (really the execution time). You can see how to set these here http://aspnetupload.com/HowTo.aspx#HandleLargerUploadsAndAvoidTimeouts[^]
Secondly these limits are there for a reason: allowing uploads of large files isn't normally a good idea, especially on a public website. You need to have think about whether this is really necessary: its slow for the user, has the potential to fill your disk-space quickly and can be used as part of a DoS attack. You should sanity check what is happening, for example can the file be put onto the server by other means than the web-interface.
Thirdly (assuming you still have the need) you might want to consider a richer upload control. There is one here[^] reference as part of a discussion on large file uploads elsewhere. I haven't used it, and so can't vouch for it, but I've found others helpful in the past.
|
|
|
|
|
The time is not the problem, theres a config setting you need to change in web.config:
http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.100).aspx[^]
the setting is called <httpRuntime>, you need to change the maxRequestLength to the maximum size you will allow for your request.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Network Error (tcp_error)
A communication error occurred: ""
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
|
|
|
|
|
Dear Friends,
Anyone knows how to download and delete files from FTP and its possible also that the client is uploading it so let them upload?????
|
|
|
|
|
For download and delete check the System.Net.FtpWebRequest[^]class.
Examples for both are down the page.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Use a tool like filezilla for uploading or deleting files in ftp.
|
|
|
|
|
So, i've exausted my sources for search without any success.
I currently have a Web Application that works as a quiz engine (i hope that's the correct translation) in where the administrator can enter Questions and options for answers, including predefined ones (that generate a list of radio buttons or checkboxes), calculated ones (no problem here) and free-text ones.
now, the need arraived for a medical quiz that has one question that requires the user to include a file in the answer.
currently, when the page that displays the quiz form is posted, the controller receives the following structure:
Form
-form fields
- question collection
- Question
-question fields
//i neeed the attachment to go here, on the question object
- options collection
there's any way i can get this? as the structure isn't constant (as in i don't even know what types of options will be sent back, their quantities or even if i need a attachment) I can't receive a IEnumerable<HttpPostedFileBase> on the controller, so i don't see any options here....
EDIT: acidentally posted the question while i was writing it, sorry.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
I just found that the reason my files aren't being posted is that i was using JQuery Ajax, that formated the response with the wrong content-type. as of my search, there's no way to do this by ajax.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
Hello experts..
How can i implement sign in popup like that exist in codeproject.com
Please suggest me the way to implement that using Jquery or Javascript.I also have to show details from the database.
thanks in advance
|
|
|
|
|
Check here[^] to get started with the in-place "popup" form. It isn't exactly like CP but you can easily modify it to fit your needs.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I am having problem in Uploading 500 MB File on web server
can anyone help me
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileName
Dim streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = Nothing
Dim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
requestObj.Method = WebRequestMethods.Ftp.UploadFile
requestObj.Credentials = New NetworkCredential("UserID", "Password")
Dim requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
requestObj = Nothing
Return True
Catch ex As Exception
Return False
End Try
End Function
|
|
|
|
|