I’ve downloaded your C# WebForms demo and I’m seeing the following code on the Default.aspx page.
<%= GroupdocsComparison.Comparison("#comparison-wrapper")
.SourceFileName(“Tables.Source.docx”)
.TargetFileName(“Tables.Target.docx”)
.ResultFileName(“Redline.docx”)
.ImmediateCompare()
%>
I understand that you’re populating the comparison -wrapper div with the contents of the Redline.docx to the page as an image.
I’d like to completely remove all code from the ASPX page and do everything in a code behind file. How do I go about doing this so that everything is from memory (I see I can load the source and target file from a stream but I can’t do the same for the result file name).
I’ve modified the files to have the following code:
Default.aspx
<asp:Content runat=“server” ID=“BodyContent” ContentPlaceHolderID=“MainContent”>
</asp:Content>
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
ClientHelper clientHelper = GroupdocsComparison.Comparison("#comparison-wrapper");
clientHelper.SourceFileName(String.Empty, new MemoryStream(System.IO.File.ReadAllBytes(Server.MapPath("~/App_Data/Tables.Source.docx"))));
clientHelper.TargetFileName(String.Empty, new MemoryStream(System.IO.File.ReadAllBytes(Server.MapPath("~/App_Data/Tables.Target.docx"))));
clientHelper.ResultFileName(“Redline.docx”);
clientHelper.ImmediateCompare();
}
But I’m getting the following error which comes from the Site.Master file:
The comparison ‘Undefined’ is not supported.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Groupdocs.Comparison.Exceptions.ComparisonException: The comparison ‘Undefined’ is not supported.
Source Error: Line 22:
Line 23: <asp:PlaceHolder ID=“PlaceHolder2” runat=“server”>
Line 24: <%: GroupdocsComparison.CreateScriptsLoadBlock().UseHttpHandlers() %>
Line 25: </asp:PlaceHolder>
Line 26:
|
Source File: c:\Program Files (x86)\GroupDocs\Comparison 2.0 for .NET\Samples\GroupDocsComparisonWebFormsDemo\Site.Master
Line: 24
Stack Trace: [ComparisonException: The comparison ‘Undefined’ is not supported.]
Groupdocs.Comparison.ComparisonFactory.CreateHtmlComparison(IComparisonResult result, Context context, ComparisonType comparisonType) +123
Groupdocs.Comparison.ComparisonFactory.CreateComparison(IComparisonResult result, Context context, ComparisonType comparisonType) +91
Groupdocs.Comparison.ComparisonFactory.Create(Context context) +105
Groupdocs.Comparison.ComparisonApiFacade.Compare(Context context, ProgressDelegate progressDelegate) +16
Groupdocs.Web.UI.Comparison.ComparisonService.Compare() +325
Groupdocs.Web.UI.Comparison.ClientHelper.GenerateClientCode() +34
Groupdocs.Web.UI.Comparison.ClientScriptLoaderHelper.ToString() +1585
Groupdocs.Web.UI.Comparison.ClientScriptLoaderHelper.System.Web.IHtmlString.ToHtmlString() +9
System.Web.HttpUtility.HtmlEncode(Object value) +38
ASP.site_master.__RenderPlaceHolder2(HtmlTextWriter __w, Control parameterContainer) in c:\Program Files (x86)\GroupDocs\Comparison 2.0 for .NET\Samples\GroupDocsComparisonWebFormsDemo\Site.Master:24
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
|
If I remove this line from the Site.Master file, the page renders but it’s completely blank.