troubleshooting Question

Problem Displaying HTML file in ASP.NET

Avatar of tomwalker1949
tomwalker1949Flag for United States of America asked on
ASP.NET
3 Comments1 Solution259 ViewsLast Modified:
I am doing an ASP.NET project using VB, using Visual Studio 2017.  As part of the project, I am creating a customer report as a .html output file.  When the file has been created, I want to open it in another browser tab or window, so it can be viewed and/or printed.  The file is being created perfectly, but when I do a "response.redirect" command to the full pathname of the file, Google Chrome gives an error "ERR_UNSAFE_REDIRECT".  If I change the pathname from Windows format to "file:///..." format, I get the same error.

When I tried this,

        Dim s As String = "window.open('" & Server.UrlEncode(Report_URL.ToString()) & "', 'popup_window', 'width=300,height=100,left=100,top=100,resizable=yes');"
        ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)

the pop-up window opens OK, but instead of my file, it has a 404-page-not-found error, which shows the requested URL and Physical Path with

Requested URL         http://localhost:62761/MenuAdmin/file:/F:/customer/outbox/OrderStatusReport.html
Physical Path         F:\customer\ASMFG\ASMFG\ASMFG\MenuAdmin\file:\F:\customer\outbox\OrderStatusReport.html

Correct Path is         F:\customer\outbox\OrderStatusReport.html

How do I get ASP.NET to use my file's correct pathname?  Or is there a different place I can create the file that would prevent ASP.NET from mangling its pathname?  Or how would I just print the HTML file to a selected printer and not worry about the screen display part?

Thanks in advance for the help!
ASKER CERTIFIED SOLUTION
Rikin Shah
Microsoft Dynamics CRM Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros