# c# HTTP get method for livestreamrecord

**URL:** <https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366>\
**Category:** Wowza Streaming Engine\
**Created:** [July 30, 2014, 8:28am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366 "2014-07-30T08:28:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Close](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Ben\_Close](https://community.wowza.com/u/Ben_Close)\
**Post date:** [July 30, 2014, 8:28am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/1 "2014-07-30T08:28:55Z")

</div>

Hello I need some help with livestreamrecord recording via http url c# calls,

I can start and stop a stream recording using:

http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording

When inputting it directly in to a browser but when I try to do the same from c# on a webpage nothing happens.

```auto
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording);
        request.Method = "GET";
        request.Proxy = new WebProxy("[wowza-ip-address]", 8086);
        request.Credentials = new NetworkCredential("[username]", "[password]");        
        request.ContentType = "application/x-www-form-urlencoded";
        
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        Stream stm = response.GetResponseStream();

```

When I first tried to set it up I kept getting 401 unauthorized error which the code above no long throws, but now I’m stuck as no error is thrown and still no recording is started.

Ben

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [July 30, 2014, 12:02pm UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/2 "2014-07-30T12:02:11Z")

</div>

Hello Ben,

When you run the query via your application, what does it return now (as you said you aren’t getting 401 responses any longer)? Have you tried querying http://[wowza-ip-address]:1935 and, if so, what does it return (should return wowza version string)?

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [July 30, 2014, 9:44pm UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/3 "2014-07-30T21:44:16Z")

</div>

This would suggest the application is faulty here if the direct url (in the browser) initiates the recording and this doesn’t. The fact that it gives you back the Wowza version html page would also suggest it isn’t even hitting the livestreamrecord http provider (as the com.wowza.wms.http.HTTPServerVersion module returns this value).

As a test for your c# application, you could set the AuthenticationMethod to “none” in the livestreamrecord HTTP Provider and see if you are able to have any further luck (ensure you _only_ do this on a test environment as it will remove security from the livestreamrecord provider).

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [August 1, 2014, 6:32am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/4 "2014-08-01T06:32:42Z")

</div>

In my tests, I think one way you could handle it for test purposes, is to set AllowAutoRedirect to false as there is a 302 redirect (or handle the redirect appropriately). Something like the following as an example:

```auto
string url = @"http://localhost:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "text/plain";
request.AllowAutoRedirect = false;
request.Credentials = new NetworkCredential("[username]", "[password]");
HttpWebResponse result = (HttpWebResponse)request.GetResponse();
Stream receiveStream = result.GetResponseStream ();
//.... cleanup etc..

```

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [August 2, 2014, 7:34am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/5 "2014-08-02T07:34:31Z")

</div>

Ok great. Thanks for the update.

Matt

---

<div class="post-metadata">

**Author:** ![Ben\_Close](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Ben\_Close](https://community.wowza.com/u/Ben_Close)\
**Post date:** [July 30, 2014, 9:41am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/6 "2014-07-30T09:41:02Z")

</div>

Hi Matt,

It returns:

```auto
<html><head><title>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</title></head><body>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</body></html>

```

In both cases.

Ben

---

<div class="post-metadata">

**Author:** ![Ben\_Close](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Ben\_Close](https://community.wowza.com/u/Ben_Close)\
**Post date:** [July 31, 2014, 2:50am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/7 "2014-07-31T02:50:25Z")

</div>

Made a couple of changes and made the request as simple as possible.

```auto
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording);
        request.Method = "GET";
        request.Credentials = new NetworkCredential("[username]", "[password]", "[domain]");
        
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        Stream stm = response.GetResponseStream();

```

This now does stop and start the recordings but at the same time throws the error: The remote server returned an error: (401) Unauthorized.

So it’s telling me that it’s not unauthorized but still runs the command.

---

<div class="post-metadata">

**Author:** ![Ben\_Close](https://avatars.discourse-cdn.com/v4/letter/b/a698b9/32.png) [@Ben\_Close](https://community.wowza.com/u/Ben_Close)\
**Post date:** [August 1, 2014, 5:35am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/8 "2014-08-01T05:35:18Z")

</div>

Thank you, setting

```auto
request.AllowAutoRedirect = false;

```

worked perfectly.

---

<div class="post-metadata">

**Author:** ![Seamus\_McNicholl](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Seamus\_McNicholl](https://community.wowza.com/u/Seamus_McNicholl)\
**Post date:** [October 3, 2020, 5:27am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/9 "2020-10-03T05:27:10Z")

</div>

Hi Matt/Ben,

I’m getting exactly same issue, tried the suggest solution but it couldn’t resolved my issue.  
Whatever we send in request, every time we getting same response

It reeturns:

```auto
<html><head><title>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</title></head><body>Wowza Streaming Engine 4 Perpetual Edition 4.0.1 build10615</body></html>

```

---

<div class="post-metadata">

**Author:** ![Seamus\_McNicholl](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Seamus\_McNicholl](https://community.wowza.com/u/Seamus_McNicholl)\
**Post date:** [October 5, 2020, 10:49am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/10 "2020-10-05T10:49:04Z")

</div>

After upgrading to wowza 4.8.5 version, we getting below issue

```
<title>Wowza Streaming Engine 4 Subscription Edition 4.8.5 build20200616153358</title>

```

Wowza Streaming Engine 4 Subscription Edition 4.8.5 build20200616153358

---

<div class="post-metadata">

**Author:** ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)\
**Post date:** [October 5, 2020, 1:57pm UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/11 "2020-10-05T13:57:16Z")

</div>

This is the response I usually get from hitting port 8086 or 1935 instead of 8087. Can you try the same query but on port 8087?

Also make sure you are using the right authentication strategy that matches your Server.xml config. I use digest, and do something like this -

```
var credCache = new CredentialCache();
credCache.Add(new Uri(url), "Digest", new NetworkCredential(user, password));
var httpClient = new HttpClient(new HttpClientHandler { Credentials = credCache });
var response = await httpClient.GetAsync(url);
```

---

<div class="post-metadata">

**Author:** ![Seamus\_McNicholl](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Seamus\_McNicholl](https://community.wowza.com/u/Seamus_McNicholl)\
**Post date:** [October 6, 2020, 7:21am UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/12 "2020-10-06T07:21:00Z")

</div>

Thanks Amara\_Graham for your valuable suggestion.

It’s an issue with Wowza new updates (Version 4.8.5), which has been sorted out.

Now we’re facing another issue i.e. when we try to start recording on other instance than _defInst_, it says **“Stream Not Found: test.stream”**. while it exists on stream files

Do you have an idea?

---

<div class="post-metadata">

**Author:** ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)\
**Post date:** [October 19, 2020, 2:50pm UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/13 "2020-10-19T14:50:31Z")

</div>

Hi Seamus,

I somehow missed this post. Are you still experiencing this issue? If so, I would recommend opening a support ticket.

---

<div class="post-metadata">

**Author:** ![Seamus\_McNicholl](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Seamus\_McNicholl](https://community.wowza.com/u/Seamus_McNicholl)\
**Post date:** [December 30, 2020, 12:30pm UTC](https://community.wowza.com/t/c-http-get-method-for-livestreamrecord/43366/14 "2020-12-30T12:30:44Z")

</div>

Thanks Amara\_Graham.

This issue had been resolved.
