eric
eric

Reputation: 1020

Response.Redirect() is dealing an Absolute URL as an relative URL

I have a .net C# page that redirects to an absolute url, eg:

Response.Redirect("rtsp://myvideoServer.com/myVideoAddress.mp4?ticket=1234&dt=1234");

But after the redirecting it results in:

"http://m.mysite.com/rtsp://myvideoServer.com/myVideoAddress.mp4?ticket=1234&dt=1234"

It works fine if I write the url to an HTML page and click the address. But the redirection does that mess.

The most weird is that it worked before last version.

Do you have any ideas? I'm almost doing a workaround to solve that.

Upvotes: 3

Views: 3228

Answers (2)

Adrian Iftode
Adrian Iftode

Reputation: 15673

Response.StatusCode = 301;
Response.AddHeader("location","rtsp://myvideoServer.com/myVideoAddress.mp4?ticket=1234&dt=1234");
Response.End();

EDIT is not working with browsers

I don't think a browser understands the rtsp protocol (in the meaning of doing e GET request in other way than from an embedded object), but if you have a client which understands this redirect, this should work.

Upvotes: 5

Kevin Stricker
Kevin Stricker

Reputation: 17388

I would suggest doing a workaround.

Use Response.AddHeader instead. It looks like Response.Redirect isn't recognizing rtsp:// as a protocol, and is treating it as a relative path.

Response.AddHeader("Location","rtsp://myvideoServer.com/myVideoAddress.mp4?ticket=1234&dt=1234");

Upvotes: 1

Related Questions