Problem Displaying HTML file in ASP.NET

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!
tomwalker1949Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

I assume you have created HTML report and stored on a path you have mentioned. However, your ASP.net application is hosted on temp IIS with a different path. As your report path is not hosted on temp IIS, your asp.net will not be able to find the file.

You can put the HTML file in some folder in the same ASP.net project and use relative path to redirect.

In your case it should be somewhat like this- http://localhost:62761/<newfolder>/OrderStatusReport.html

Makes sense?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomwalker1949Author Commented:
That is correct -- I am running the project in a debug session through Visual Studio .NET when I received the error.  

When I deploy the project to a production environment however, will the absolute path work with "response.redirect" or "window.open"?  If I create a "reports" folder for the project, that folder will travel to the production environment as well?
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
Hi,

Same scenario will apply to production as well.. there has to be a Virtual Directory.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.