c# - HTTP Hanlder for string return asp.net -
I am using the vlc plugin to play RTP links for live streaming. If the code below has the streaming link in the target tag, then it works fine:
& lt; Embed type = 'application / x-vlc-plugin' pluginspage = 'http: //www.videolan .org' version = 'VideoLAN.VLCPlugin.2' width = '800' height = '600' id = 'VLC' loop = 'Yes' autoplay = 'yes' target = "RTMP: //122.221.75.124: 1935 / live / myc001" & gt; & Lt; / Embed & gt; Problem: Then my requirement is to hide the RPM link from the viewer by showing the HTML source code. I used the HTT handler to return links from the database. The Vlc plugin is the target tag: target = "handler1.ashx? ChannelID = 22" & gt; And my Hanlder1.ashx code is:
Public class Handler1: IHttpHandler {Public Zero ProcessRequest (HttpContext Reference) {if (context.Request.QueryString ["ChannelID"] == blank) return; String connStr = Connection_Class.Str_Conn; String channelID = context.Request.QueryString ["ChannelID"]; If (channelID == "") {return; } Use (SqlConnection Conn = New SqlConnection (connStr)) using {{SqlCommand cmd = new SqlCommand ("TblChannel select link where channel- = @id", Connecticut)) {cmd.Parameters.Add (New SqlParameter ("@ id", channel id)); Conn.Open (); (Using SqlDataReader Reader = cmd.ExecuteReader (CommandBehavior.CloseConnection)) {reader.Read (); If (reader.HasRows == true) {string lnk = ""; Lnk = Reader ["Link"]. ToString (); Context.Response.Clear (); Context.Response.Write (lnk); Reader.Close (); Context.Response.End (); } And {return; }}}} When I type in the browser, the link will return exactly:
http: // localhost: 54091 / handler1. Ashx? Channel- = 22 I used the same method in the VLC target tage: (target = "http: // localhost: 54,091 / handler1.ashx channel- = 22"), but the link Does not run. I have used the break point to verify that the handler works and returns with the string but VLC stream does not run.
I tried 302 redirects and did not respond to both VLC. The problem is that VLC is expecting RTMP or RTIP protocol and you are trying to redirect it to the HTTPS layer - which does not work, you have to redirection at the rmpt level or make a rmpt proxy rather than the http handler. If you are going that way - looks like a great .NET API for the job.
On the other hand (I do not know how much control you have on the Raptost server and thus assume that it has some control) hacking in the hedgehog stage - that means you will generate links directly to RMTP And as a part of the link, you will pass the Simetric encrypted token. - To wit. Rmpt: // whatver? Token = Mystery timestamp in the secret section and some random ruby to make it safe; The server will decode the server token and reject all requests that are old timestamps - in this way people can see the link, but after some time it will be unusable.
Comments
Post a Comment