Storing video on hard drive using ASP.NET

Discussion in 'General Computer Support' started by irfanmcsd, Aug 27, 2007.

  1. irfanmcsd


    Aug 27, 2007
    Likes Received:
    Hi i am using ASP.NET to store videos especially flv on hard drive, but when storing completes, file exist but it can't play can any one help me why it is not saving in exact format as i want. the code that i am using is shown below.

    Dim url As String = ""
    Dim req As System.Net.HttpWebRequest
    Dim res As System.Net.HttpWebResponse
    req = System.Net.HttpWebRequest.Create(url)
    req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"
    res = req.GetResponse()
    Dim receiveStream As Stream = res.GetResponseStream()
    Dim readStream As StreamReader = New StreamReader(receiveStream)
    Dim strPath As String = Server.MapPath(Request.ApplicationPath) & "/contents/"
    Dim _filestream As FileStream = New FileStream(strPath & "/get_video.flv", FileMode.Create, FileAccess.Write)
    Dim offset As Integer = 0
    Dim length As Integer = 10000
    Dim datatoread As Integer = res.ContentLength
    Dim buffer(datatoread) As Byte
    _filestream.Write(buffer, offset, datatoread)
    _filestream.Seek(0, SeekOrigin.Begin)
    _filestream = Nothing

    Waiting for some help!!!!

    irfanmcsd, Aug 27, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.