Free Support Forum - groupdocs.com

Simple ASP.NET Example with stream

Hi


I’m frustrated getting it work and i cannot understand what is the problem.

I’m with version 2.16 and i didn’t found the appropriate example in the examples showcase of version 17.2.

This is the exception:

<pre style=“background-color: rgb(255, 255, 204); font-family: Consolas, “Lucida Console”, monospace; font-size: 11pt; margin-top: 0px; margin-bottom: 0px; padding: 0.5em; line-height: 14pt;”>[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +139
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +146

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +742
System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize) +75
Groupdocs.Web.UI.Helper.SaveStreamToFile(Stream stream, String streamFileName, String fileExtension, IFileStorage sourceFileStorage, String downloadPath, Boolean useCachedStreamContentsIfPossible, Func`1 streamCreator, String targetElementSelector) +440
Groupdocs.Web.UI.ClientHelperBase.ToString() +1421
System.Web.HttpWriter.Write(Object obj) +44
ASP.gdview_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) +2487
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +263
System.Web.UI.Page.Render(HtmlTextWriter writer) +39
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921<pre style=“background-color: rgb(255, 255, 204); font-family: Consolas, “Lucida Console”, monospace; font-size: 11pt; margin-top: 0px; margin-bottom: 0px; padding: 0.5em; line-height: 14pt;”>


Please urgently advise , i want to purchase the 23,000 USD license but i cannot do it with out any working asp.net stream example
The key feature should be viewing remote files from their URL’S but without any local files, only streams.

Thanks



Hi rinatshamir1,


Thanks for taking interest in GroupDocs.Viewer for .NET.

First of all, please note that next generation GroupDocs.Viewer for .NET (starting from v3.0.0) is a stand alone, back-end document rendering API that enables you to render the document into either HTML form or image form. In contrast with the legacy versions, the front end UI has been disintegrated from the back-end API and therefore, you will have to create your own front end application to load/display the rendered/output HTML pages or images. Moreover, the versions earlier than 3.0.0 are obsolete now.

In order to demonstrate the feature of the back-end API, we have created some open source document viewer applications. These applications will guide you on how you can create a document viewer application using next generation GroupDocs.Viewer for .NET. As the applications are open source, you can also use them and modify them as per your requirements.

We have also implemented the feature of working with streams in <a rel=“nofollow” href=“https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/tree/master/Showcases/ASP.NET_WebForm_Front_End” class=“js-navigation-open” id=“3b1c9237c5322dddadcbaffe9171d725-6619236718dc1b07fa74b2a695a283b7132d61ef” title=“ASP.NET_WebForm_Front_End” style=“box-sizing: border-box; background-color: rgb(255, 255, 255); color: rgb(3, 102, 214); text-decoration-line: none; font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Helvetica, Arial, sans-serif, “Apple Color Emoji”, “Segoe UI Emoji”, “Segoe UI Symbol”; font-size: 14px; white-space: nowrap;”>ASP.NET_WebForm_Front_End application. However, it is just to demonstrate a possible way to work with the streams. To render document from streams, you will have to uncomment line#65 of default.aspx.cs and use the same key (i-e Stream1.pdf) in filePath parameter in default.aspx in line#68.

There is also a possibility to render the document directly from the stream and from the URL. This feature is not implemented in the open source applications, however, you can get help on how to work with stream from following articles.


Furthermore, please note that the next generation API consists of a single GroupDocs.Viewer.dll and the DLLs of the versions older than v3.0.0 can not be used with the latest source code.

In case you would have any confusion, please do let us know.

Warm Regards.

Thanks for the response.

Actually i cannot view my stream , so please advise on the following :

1. Can you please check why i cannot view the file from this URL with stream ?
"https://isafe-t.com/Safe-T/file.aspx?folderType=1&sType=SMFT&sGID=8d48a31912387d0&fGID=493305&&eGID=seqIJrMPwdi1zxAKRi%2BuybGz0NdWJyJ6qMGc2Ccgb78=&&getPubFile=9NvygiKYgQO%2FF6iEizJvpw==&eURL=safe"
Note that in version 2.16 we used to get it work but not any longer.

2. Can you please advise if there any supported way not to save the stream to local file ?
Note that in version 2.16 we used to get it work but not any longer.

Hope for a quick answer , i need to get it done ASAP , and after that we will purchase the license.

Thanks

Hi there,


Thanks for your response.

I have tested to render the file from the URL you provided and the document is getting rendered without any issue. Furthermore, if you use the file stream directly in GetPages function (as mentioned in Working with Streams) then the API does not create/save it as a local file. The sample front end application does not use the stream or URL directly in GetPages function and instead, it saves the file in the local disk and then renders that local file into HTML or image. Therefore, I have created a sample console application for you to get help on how to render file from stream using a URL. You can download the application from here. Hope it helps.

Warm Regards