Created
March 11, 2015 02:00
-
-
Save jz5/b6f680309c04a80b1786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function FileStream(url As String) As ActionResult | |
Try | |
Dim req = HttpWebRequest.CreateHttp(url) | |
Dim res = DirectCast(req.GetResponse, HttpWebResponse) | |
Response.ContentType = res.ContentType | |
res.GetResponseStream.CopyTo(Response.OutputStream) | |
Catch ex As WebException | |
If ex.Status = System.Net.WebExceptionStatus.ProtocolError Then | |
Dim r = DirectCast(ex.Response, System.Net.HttpWebResponse) | |
Response.StatusCode = r.StatusCode | |
End If | |
End Try | |
Return New EmptyResult | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment