Free Support Forum - groupdocs.com

Cannot insert a node of this type at this location


#1

hi
i created web app using asp.net mvc 4 for comparison it it has two file upload field once file uploaded
compare it and show compared result.
it worked some times .but some time i upload files it give following error . i want to privet this error
how i accomplish privet this error .

Cannot insert a node of this type at this location.

Line 144:
Line 145: @RenderBody()
Line 146: @Html.CreateComparisonScriptsLoadBlock()
Line 147:
Line 148:

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: System.ArgumentException: Cannot insert a node of this type at this location.


error

[ArgumentException: Cannot insert a node of this type at this location.]
Aspose.Words.CompositeNode.xef23aa45e7612fdd(Node x40e458b3a58f5782, Node xff5adbb92d63bf52, Boolean x7f43f79506f73a73) +792
Groupdocs.Comparison.Diffs.AsposeDiff.Word.Differs.BaseDiff1.ProcessNode(Node node, CompositeNode destinationNode) +201 Groupdocs.Comparison.Diffs.AsposeDiff.Word.Differs.BaseDiff1.Execute() +33
Groupdocs.Comparison.Diffs.AsposeDiff.AsposeWordDiff.CompareNodes() +146
Groupdocs.Comparison.Diffs.AsposeDiff.AsposeWordDiff.CompareDocuments(Document sourceDocument, Document targetDocument) +292
Groupdocs.Comparison.Diffs.AsposeDiff.AsposeDiff.Compare() +453

[Exception: Unknown Exception]
Groupdocs.Comparison.Diffs.AsposeDiff.AsposeDiff.Compare() +518
Groupdocs.Comparison.Diffs.AsposeDiff.AsposeDiff.Compare(String sourceFile, String targetFile, String redlineFile) +39
Groupdocs.Comparison.Operations.AsposeCompareFiles.Execute() +161
Groupdocs.Comparison.Operations.OperationExtensions.ProcessOperation(IOperation operation) +98

[ComparisonException: Operation ‘AsposeCompareFiles’ failed: Unknown Exception]
Groupdocs.Comparison.Operations.OperationExtensions.ProcessOperation(IOperation operation) +248
Groupdocs.Comparison.Comparisons.BaseComparison.Execute(IOperation[] operations, Int32 stepPercentageFromOverall) +376
Groupdocs.Comparison.Comparisons.BaseComparison.Run() +232
Groupdocs.Comparison.ComparisonApiFacade.Compare(Context context, ProgressDelegate progressDelegate) +44
Groupdocs.Web.UI.Comparison.ComparisonService.Compare() +325
Groupdocs.Web.UI.Comparison.ClientHelper.GenerateClientCode() +34
Groupdocs.Web.UI.Comparison.ClientScriptLoaderHelper.ToString() +1579
Groupdocs.Web.UI.Comparison.ClientScriptLoaderHelper.System.Web.IHtmlString.ToHtmlString() +9
System.Web.HttpUtility.HtmlEncode(Object value) +38
System.Web.WebPages.WebPageBase.Write(Object value) +75
ASP._Page_Views_Shared__Layout_cshtml.Execute() in h:\root\home\www\site1\Views\Shared_Layout.cshtml:146
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90
System.Web.WebPages.<>c__DisplayClass7.b__6(TextWriter writer) +230
System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10
System.Web.WebPages.WebPageBase.Write(HelperResult result) +80
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action1 body) +64 System.Web.WebPages.WebPageBase.PopContext() +262 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +98 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +257 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +245
System.Web.Mvc.<>c__DisplayClass1c.b__19() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +176 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +75 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99 System.Web.Mvc.Async.WrappedAsyncResult1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +41 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +31
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514928
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
















#2

hi
please give me to answer, i send my code for better understand .here is my controller code after two files are uploaded

[HttpPost]
public ActionResult Index(HttpPostedFileBase file, HttpPostedFileBase filen)
{
if (ModelState.IsValid)
{
if (file == null || filen == null)
{
ModelState.AddModelError(“File”, “Please Upload Your file”);
}
else if (file.ContentLength > 0 || filen.ContentLength > 0 )
{
int MaxContentLength = 1024 * 1024 * 3; //3 MB
string[] AllowedFileExtensions = new string[] { “.pdf”, “.doc”, “.docx”, “.ppt”, “.txt”,".xlsx", “.xls” };

if ((!AllowedFileExtensions.Contains(file.FileName.Substring(file.FileName.LastIndexOf(’.’))) )|| (!AllowedFileExtensions.Contains(filen.FileName.Substring(filen.FileName.LastIndexOf(’.’)))))
{
ModelState.AddModelError(“File”, “Please file of type: " + string.Join(”, “, AllowedFileExtensions));
}

else if (file.ContentLength > MaxContentLength || filen.ContentLength > MaxContentLength)
{
ModelState.AddModelError(“File”, “Your file is too large, maximum allowed size is: " + MaxContentLength + " MB”);
}
else
{
//TO:DO
var fileName = Path.GetFileName(file.FileName);
var fileNamen = Path.GetFileName(filen.FileName);

var pathxyz = Server.MapPath(”~/App_Data");

file.SaveAs(Path.Combine(pathxyz, fileName));
filen.SaveAs(Path.Combine(pathxyz, fileNamen));


ModelState.Clear();
ViewBag.Message = “File uploaded successfully”;
ViewBag.name = fileName;
ViewBag.namen = fileNamen;
}



my viewer code

@if(ViewBag.name != null & ViewBag.namen != null){

@(Html.Comparison("#comparison-wrapper")
.SourceFileName(ViewBag.namen)
.TargetFileName(ViewBag.name)
.ResultFileName(“Redline.docx”)
.ImmediateCompare())
}

}



how can i fix this issue
thank you


#3

Hi Srinath,


Thanks for getting in touch,

Can you share some test files that are causing the errors to occur, either attach to this thread or share a folder with files using Dropbox (probably a better strategy).

This way we can reproduce the issue using the same test files.

Many thanks,

Derek

Derek Hyland, Venture Lead, GroupDocs (Aspose Pty Ltd)
Office: +1 (214) 329 9760
Skype: derekh.aspose


#4

Hi,

My code can be download from the following url.
https://www.dropbox.com/s/ct0zomwmk76uelg/MvcApplication1.rar

Please check and answer as soon as possible.

Thanks,
Srinath


#5

Hello Srinath,

Sorry for such long delay, we had to review your project before answering. We had downloaded and reviewed your project, however, we cannot find any problems in it, all works perfect, GroupDocs.Comparison shows the differences between two uploaded documents correctly.

Maybe, the reason of the problem is related to the specific files which are used for comparing. Personally I used DOC and DOCX and 2 PDFs for comparison. In that case you can send us the sample files which you have used and with which the exception occurs.

I also used IIS Express 8.0 web-server.

Thanks and waiting for your response.