Click here to Skip to main content
14,733,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I am new to angular 8 and asp.net core. I have a situation where I want to create a api url to generate PDF file from ASP.Net Core 3 web api and open in separate window and also to open as a preview mode, for which I use iframe.
My problem is,
I am able to achieve both scenario in localhost with below mentioned code. But when I deploy my application in server machine using iis, separate window opens, but getting this exception
Quote:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'customer/details/standard/FileName'

quick sample of my code
frameUrl(){
var urlString="app_host_path/customer/details/${some_usertype}/${some_filename}?token=token_already_generated";
return this.domSanitizer.sanitize(SecurityContext.RESOURCE_URL,  
      this.domSanitizer.bypassSecurityTrustResourceUrl(urlString))
}
openPdf(){
window.open(this.frameURL(),"_blank")
}


for preview mode,in html I use this code,
<iframe id="dfrPreviewFrame" [src]="frameUrl"></iframe>


What I have tried:

Generally we use Window.open(url,'_blank') which works fine in localhost, but not in deployed server.
Also I came to know window.open(url) itself will open in separate window,here also works in local but not in server.

Any help, would be appreciated!
Thanks in Advance!!
Posted
Updated 25-Jun-20 1:29am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900