FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

After releasing the post about FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler I have received a couple of requests on how-to run the handler on ASP.NET v1.1, so I decided to "downgrade" the solution and the code to match compatibility with the "old" framework version.

All you need is to install on your IIS 5.0/6.0 the following HTTP handler and to get this to work correctly, you will need to make sure that IIS handles request for .flv files. In your site's properties, click the "Home directory tab" and click the "Configuration" button. You'll get a form like this:

IIS Configuration step 1

Add the entry for .flv, click edit, and copy the path in the executable field. This is the aspnet_isapi.dll for the current version of the .NET Framework v1.1 of your virtual site. Cancel out of that dialog and click "add." Paste the path into the executable, use the extension .flv and set your verbs limited to "GET, POST, HEAD, DEBUG" like this:

IIS Configuration step 2


Now any request for a .flv file on the site will be handled by ASP.NET and you are ready to watch your favourite FLV movies:

You can download ASP.NET v1.1 solution and project files here solution and project files or if you have the chance check online demo here.

For detailed information and ASP.NET 2.0 version have a look to FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler or feel free to contact me.

Technorati tags: , , , ,

posted @ domenica 26 novembre 2006 15:14

Print

Comments on this entry:

# FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler

Left by kfra at 15/01/2007 01:13
Gravatar
Using this HTTP handler you can easily FLV streaming downloads just like video.google.com does...

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by Chaitanya at 27/01/2007 05:55
Gravatar
Thanks for providing this type of things, but my requirement is that i need to convert the data to flv format while uploading the video can any one help me

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by Carlo at 01/02/2007 03:46
Gravatar
All you old school classic ASP programmers (like me)... I spent my day working on this, and now I'm giving back. I basically reused some ASP code on the web, and adapted it to how the PHP script was working. Enjoy...

<%@Language="VBScript"%>
<%Option Explicit%>
<%Response.Buffer = True%>
<%
On Error Resume Next
Dim strPath
strPath = CStr(request("file"))
'-- do some basic error checking for the QueryString
If strPath = "" Then
Response.Clear
Response.Write("No file specified.")
Response.End
ElseIf InStr(strPath, "..") > 0 Then
Response.Clear
Response.Write("Illegal folder location.")
Response.End
ElseIf Len(strPath) > 1024 Then
Response.Clear
Response.Write("Folder path too long.")
Response.End
Else
Call DownloadFile(strPath)
End If

Private Sub DownloadFile(file)
'--declare variables
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
Dim pos
if isnumeric(pos) then
pos = cdbl(request("pos"))
else
pos = 0
end if

'-- set absolute file location
strAbsFile = Server.MapPath(file)
'-- create FSO object to check if file exists and get properties
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'-- check to see if the file exists
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
'-- first clear the response, and then set the appropriate headers
Response.Clear
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "video/x-flv"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
'-- load into the stream the file
objStream.LoadFromFile(strAbsFile)
objStream.Position = pos
'-- send the stream in the response
If pos > 0 then
Response.Write "FLV"
Response.Binarywrite(chrb(1)&chrb(1)&chrb(0)&chrb(0)&chrb(0)&chrb(9)&chrb(0)&chrb(0)&chrb(0)&chrb(9))
end if
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
Else 'objFSO.FileExists(strAbsFile)
Response.Clear
Response.Write("No such file exists.")
End If
Set objFSO = Nothing
End Sub
%>

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by Srujan at 30/05/2007 10:41
Gravatar
Hi,

How can i restrict someone from watching the flv video directly, i mean if he tries to type the url path of the flv directly in the browser, he should not be allowed to view the video file, the users should only be allowed to watch the movie, from the web site.

Srujan.

# FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler

Left by Kris - TECH at 13/06/2007 13:24
Gravatar
Reference from : http://blogs.ugidotnet.org/kfra/archive/2006/10/04/50003.aspx Using this HTTP handler

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by FDE at 27/08/2007 17:50
Gravatar
Hello.

I found a bug in your .Net 1.1 Source Code: at line 31:
if(qs == null && qs == string.Empty)

I think this will never happend ;-)
Here's my solution:
if (qs == null || qs.Trim().Equals(String.Empty))

Sincerely yours,
FDE

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by Francesco Meani at 27/08/2007 19:57
Gravatar
Hi,
thanks for your bug report. I havejust patched the 1.1 code and repacked it.

Best,

Francesco.

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by ammar at 27/11/2007 15:28
Gravatar
I want to make a Web Development where If User Uploading any Movie file then it will automatically converting into FLV.
How can i Do that in Asp.Net 2.0

# some sample example for the FLV Flash video c#(ASP.net 2.0)

Left by prasanth at 05/01/2008 08:35
Gravatar
Give me the some example for the FLV Flash video
.I am see the code but that i.e in .cs i am also use the HTML code but it will not works please give me the some sample example code in c# so that i can understand.

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by MM at 25/06/2009 12:26
Gravatar
How to add the .flv file dynamically in this script using in asp.net c#

# re: FLV Flash video streaming with ASP.NET 1.1, IIS and HTTP handler

Left by Gu at 11/07/2010 17:04
Gravatar
Help.
WS 2008 R2
Vs 2010
Test.aspx code
...
<script type='text/javascript' src='swfobject.js'></script>
<div id='Plr2'>Video</div>
<script type='text/javascript'>
var so1 = new SWFObject('player.swf', 'ply', '470', '320', '9', '#000000');
so1.addParam('allowfullscreen', 'true');
so1.addParam('allowscriptaccess', 'always');
so1.addParam('wmode', 'opaque');
so1.addVariable('file', 'Test.flv');
so1.write('Plr2');
</script>
...
In Vs2010 runing, all ok, file playing
In IIS 7 public, player not working :(

2. MIME Type box: flv-application/octet-stream
Not work
Comments have been closed on this topic.
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011