|
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
|
|
|
|
|
You're missing a call to GetResponse on the FtpWebRequest instance. The request won't be sent until you call GetResponse .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
silentspeaker wrote: what is it
What is what?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I dont know how to add it. Need assistance here
|
|
|
|
|
Something like this:
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileName
Using streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
End Using
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")
Using requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
End Using
Using responseObj As FtpWebResponse = TryCast(requestObj.GetResponse(), FtpWebResponse)
' TODO: Look at responseObj.StatusCode to see if the upload succeeded
End Using
Return True
Catch ex As Exception
Return False
End Try
End Function
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
|
|
|
|
|
|
You need to tell us what web server your using, IIS6 requires the metabase editor to change one of the values, I think max request length, under IIS/Defaults. So you can change the value in Web.config, but the metabase supersedes the web.config overall.
IIS7 was a e bit easier it doesn't use metabase, there's a config file in IISAdmin folder, in system32, that you just edit. After you edit it, I think it changes a more complex structure in the background.
[Edit]
I messed with the upload limit for years, and tried everything, but the limit is the limit. I'm not sure about FTP, I have changed my servers to 1 gig, which is the limit for Server 2003, but you have to login to do it. I ended up using Uploadify, which works pretty good.
The metabase editor is available in the IIS resource kit, an old download from microsoft.
modified 8-Nov-12 1:39am.
|
|
|
|
|
|
How can i get all IP addresses which connected in LAN using ASP.NET
//
Private Function GetIP4Address() As String
Dim IP4Address As String = [String].Empty
For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName())
If IPA.AddressFamily.ToString() = "InterNetwork" Then
IP4Address = IPA.ToString()
Exit For
End If
Next
Return IP4Address
End Function
//
I'm using this function but it returns only my IP address.
Please help me...
Thanks in advance...
|
|
|
|
|
The first thing you ought to learn is: differenciate between code executed on the server and code executed on the client (user site).
You say you are using ASP.NET - just think: where is that code executed?
And another thing you ought to learn: there are many security mechanisms when it comes to code (JavaScript etc.) running in a web browser! Why should anyone want to allow you to find out which other IP addresses are used in his local (private) network? Because he wants to make a virus/worm attack easy for some hacker?
|
|
|
|
|
Thank you sir , but i want to know only that IP address which are connected Client site LAN only.Is it possible?
|
|
|
|
|
Dim ipaddress As String = HttpContext.Current.Request.UserHostAddress by using this we can get client ip address
and
Dim ipaddress As String = HttpContext.Current.Request.UserHostName by using this we can get client host name
|
|
|
|
|
Thanks ......Its working.
N.K.Basak
|
|
|
|
|
Hello!
I have developed a website project in visual studio express 2005 (.net framework 2.0) and sql server express 2005. Now I am trying to run this project in visual team studio 2008 (.net framework 3.5) and sql server 2005 but it's showing below error when I'm trying to run that project:
it is giveing error like this..
Line 161:
Line 162: <provider>
Line 163: <add name="OracleSiteMapProvider" type="Oracle.Web.SiteMap.OracleSiteMapProvider, Oracle.Web, Version=2.111.5.10, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraAspNetConString"; applicationName=""; securityTrimmingEnabled="true"/>;
Line 164: </provider>
Line 165:
|
|
|
|
|
If this script have not content just delete it. Maybe error will be cut with it.
No more Mister Nice Guy... >: |
|
|
|
|
|
Something is wrong from the config file. I am not sure if the error you pasted in is accurate or not but it seems to indicate a stray semi-colon.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
I have aspx and i have few ascx within the same aspx. I want to use a page variable for it so it should be readable from any part of the page, from aspx or any of its ascx, something like the session but for that page only.
what's your idea?
|
|
|
|
|
VieState or ControlState plus some helper class. I don't see other alternatives. Maybe custom Page class with custom Controls, but it is harder to acomplish.
No more Mister Nice Guy... >: |
|
|
|
|
|
Create an object for MyPage class like
MyPage myPage = new MyPage();
myPage.productName = "adidos";
productName is a variable of your page
|
|
|
|
|
I'm experimenting with the httpModule, using XP and IIS5.1, asp.net 4.0, in which I want to take a file called display.aspx?pNp=XXXX and turn it into a file name XXXX.aspx.
So I wrote the first part, I know what context.Items("originalUrl") is for, but I'm not sure if I actually need it, because I don't don't have the second part written or working yet. It's been awhile since my last 3 failures at attempting this.
I'd like to get another set of eyes on my code, before I procede, in case I really blew it here. And see if there are any mistakes.
It seems to work, and I get the error message below, so I figure it's ok.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /EN-US/part-lookup/catagory/XXXX.aspx
Imports Microsoft.VisualBasic
Public Class http_module_Details
Implements IHttpModule
Public Sub Init(context As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler context.BeginRequest, AddressOf context_BeginRequest
AddHandler context.PreRequestHandlerExecute, AddressOf context_PreRequestHandlerExecute
AddHandler context.EndRequest, AddressOf context_EndRequest
End Sub
Private Sub context_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
Dim application As HttpApplication = DirectCast(sender, HttpApplication)
Dim context As HttpContext = application.Context
If Not context.Items("originalUrl") Is Nothing Then
context.RewritePath(Convert.ToString(context.Items("originalUrl")))
End If
End Sub
Private Sub context_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Dim application As HttpApplication = DirectCast(sender, HttpApplication)
Dim context As HttpContext = application.Context
If (context.Request.RawUrl.ToLower.Contains("details.aspx")) Then
context.Items("originalUrl") = context.Request.RawUrl
End If
Dim originalPath As String = context.Request.Url.ToString()
If Not context.Request.QueryString("pNp") Is Nothing Then
Dim cP As String = context.Request.ServerVariables("SCRIPT_NAME")
cP = cP.Replace("Details.aspx", "").Replace("details.aspx", "")
Dim pn_P As String = HttpUtility.UrlDecode(context.Request.QueryString("pNp"))
Dim scriptName As String = cP & pn_P & ".aspx"
context.RewritePath(scriptName)
End If
End Sub
Private Sub context_EndRequest(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
End Sub
End Class
|
|
|
|
|
Hello all,
I am creating a point of sale application but I have an issue that I have a page in which I want to show the Product Items and on the same page I want to display the cart.I have done this by using the frame set but the issue is whenever I have added a new item it doesn't show on a cart untill I refresh the whole page.I think I have to use update panel through AJAX.But how could I apply this or any other solution could any one suggest please help me.
|
|
|
|
|
That how it works. The page has to send a request to the server to get new HTML that represents the current data stored.
The update panel just puts round trips to the server into a smaller container, so your still doing a postback, but just a partial page postback. The update panels works fine in developement, but in production mode, as you get farther away from the server in distance (4K miles away), the speed slows down, and the page gets jerky and stutters. The update panels is sensitive to data changes, with the exception of the textbox and dropdown box selected values, in which it has security features that do not accept changes. So if the server sent one thing, and another posted back, a security exception will be thrown.
You would have to use Javascript and a webservice, in which the client keeps polling for cart data, and the javascript updates the cart container, or have some type of trigger that fires off the process.
Or just change the user experience, by sending them to a confirmation page, and then send then back to the origin page. When they come back, everything is updated.
|
|
|
|
|
Hi,
I'm trying to connect to this Remote Web Service
http://217.52.114.3/kannelsending/service.asmx?op=SendSMS[^]
When I try it manually, it works, I have a username and password.
But it displays this error:
The remote server returned an error: (500) Internal Server Error.
...at this line.
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
Do I need to encrypt the parameters or what? I'm kinda new to webservices...
Am I missing something..can someone post an example to try out?
Thanks.
|
|
|
|