How to import excel file in web page useing Classic ASP? - asp-classic

We are trying to open an existing excel file (2003) from server location in a web page and save it again in the same location using following syntax.
Set ExcelReportApp = CreateObject("Excel.Application")
ExcelReportApp.Workbooks.Open("http://bocntgcasd10/AppPortfolioCatalogrnd/Templates/DatabasesList.xls")
It executes properly with out showing any error, but not showing any page i.e. web page is blank with DONE status.
Please let me know how to import or open the files (Temple) in my web page.
Thanks!

Your question is a little ambiguous as to where the code you've posted is actually running.
If the code is running server-side I don't know why you wouldn't expect a blank web page, you aren't actually sending anything to the client.
If the code is running client-side you should be getting an error in script because this sort of operation is most likely blocked the browser (in IE you will see the small yellow warning triangle at the bottom left in the status bar). Again that would result in a blank web page.

Related

Webforms showing source code instead of rendering

I'm working on a legacy project that used Webforms. There is now a bug occurring on our production servers where a few of the web pages will show source code. I cannot replicate this on our test servers or by debugging it.
If it shows source code it will persistabtly show source code until the in-private/incognito window is closed and a new one is open.
It will occur about 50% of the time (out of 100 recorded tries it failed exactly 50).
This is a screenshots of some of the source code I'm seeing:
and
A commonality between the pages that break are that it uses AjaxControlToolkit, however there are other pages that use AjaxControlToolkit that aren't breaking.
Additionally, when I try to hit these pages they don't hit the page at all. If I'm not signed in they should redirect to the login page and they don't even do that.

How do I open a specific .aspx page from Visual Studios in browser

When I compile, I want the browser to go to that page instead of going to the log in page, when I set it as Startup page, VS starts not responding and freezes the screen. This is a very simple question but I cannot find the answer to it.
For an .aspx page, many possible reasons could cause "VS starts not responding and freezes the screen". I would suggest that you check your aspx file and the code behind file to see if there is any database connection and it loads large amount of data. Any pre-initiate program error could also bring page load failure. You may try move your GUI code to a separate html file and then view it in a browser to see what happens.

ASP.NET 2.0 website white screen of death

I am encountering a strange issue which is only affecting several users from an over 7000 user-base. Having searched the web for several hours to no avail, I'm hoping someone here can help!
I have an ASP.NET 2.0 website and when certain users try to access the home page (Default.aspx) they receive a white screen with no content loaded. This issue is occurring both in production environment and if I run the solution against a copy of production data. So I am able to replicate the exact same issue when I pseudo the problematic users.
When debugging the application in VS2005 and set a breakpoint in the code behind in the Default.aspx, the breakpoints are fired/hit so I know the request is working. The problem seems to be once the server has finished serving the request, the response back to the client/browser is empty.
Here's another strange thing I've noticed. If I alter the HTML in Default.aspx by adding a new white line or whitespace, the page will load fine for the same set of users. I thought I had resolved the issue with this fix but unfortunately the white screen issue just manifests itself once again.
Within Default.aspx, there's some AJAX requests using jQuery .load function but this can't be the issue because this functionality exists for every user of the site. The only variable is the amount of content returned within this request can vary depending on the user. But why would it resolve itself when I put a whitespace or whiteline in the page and then manifest itself hours later?
Another thing to note is it's only Default.aspx that is encountering this issue. If I browse to another page by typing in a page in the address bar, the page is served OK.
Hope someone can point me in the right direction on how I can debug or even resolve the issue.
It sounds like your ajax is the cause but without seeing some code, it's difficult to know why.
It could be a timeout, or an error that is preventing the ajax from completing it's function.
You need to use a tool like Charles or Fiddler to debug what is happening whilst the page loads whilst logged in as these users. In a nutshell, a tool like Charles will display all the detail surrounding requests made and responses served to the browser, including any failed responses.
I think it has to do with http headers, caching or encoding. But I cannot tell more without code.
Is output caching enabled for this page?
Can you give us the raw http headers for both the request and response?
If a white screen appears, will it be fixed by pressing ctrl+f5?

file transfer through iframe not propagating

I'm still rebuilding old ASP to new and iframing certain things that take up too much time.
I'm stuck at a search function that normally returns an excel file (browser asks save or open). the result page for this is now iframed but it does not seem to propagate the file anymore, so no more save-file popup.
I must add that this iframe is being filled through a custom httphandler that posts to the old pages based on certain criterie, the searchcriteria in this case.
does anyone have an idea on how I could make the excel propagate once again?
The way to ensure you get a save-file prompt and not a page, do the following:
Open the file in ASP
Send the MIME header for Excel
Stream out the file from ASP
You may also choose to hold the files outside of the web root so they cannot be downloaded directly.
Here are a few examples: 1 2 3
This may come in handy as well:
How to output an Excel *.xls file from classic ASP
It *seems* like a security issue. What happens if you open the URL which is being loaded in the IFrame in a new browser? To confirm it, you can try opening the URL, and see what happens.

How can I know when .aspx call is finished?

I am building a Flex Application that calls a .aspx page on the same webserver which builds a PDF report using SQL Reporting Services. When the report is built it prompts the user to open or save the PDF.
We are trying to find a way to display a Progress Bar to let the user know that the report they requested is being built, and then destroy the Progress Bar once the report is finished being built.
I've tried opening a new window using JavaScript and trying to catch when the window closes, as well as trying XMLHTTPRequest, but nothing to seems to work.
Does anyone have any suggestions?
There are 2 options:
Use the FileReference class in Flex to programmatically invoke your aspx file. You will be able to track the progress of the call from within Flex by listening to its events. But the users can only save the PDF, not open it.
Have an intermediate HTML page that displays a loading icon and then refresh itself to your PDF generating ASPX page. Encode your aspx url along with parameters etc and set it as a parameter to this intermediate page so it knows what to load.
If you don't have control over the page to be able to put JavaScript on it to hit a URL (or call back to the parent/opener), then you might consider whipping up an aspx page of your own to host a ReportViewer control, and display the report inside of that. This would require you to create a .NET website with a page and a web.config - you wouldn't need to do more than make it receive any parameters your report needs, and it would be do-able via inline-to-the-aspx code as opposed to requiring in-depth .NET knowledge.
Or, you could hit the SS-RS API and render the report directly. Here, you'd craft a URL with parameters for the report on the SS-RS API site to accept. I think, though I don't know for sure, that the SS-RS UI uses the API itself behind the scenes. By default the API is hosted in a site called "reportserver" - you might sniff HTTP traffic while the report is being rendered to get you started with the URL that you'd need to hit.
Another option not mentioned here is to create a .Net webservice, add it to your flex project and when it hits the result handler you know the file is created at that point.

Resources