stullhe104
asked on
Response.Write from within a class module
I've build an VB class module that gathers data for a report, creates a PDF image of the finished report, and then attempts to issue a Response.Write statement to open the PDF report as follows:
Response.Write("<script>wi ndow.open( '" & HttpPath & "',target='_blank');</scri pt>")
This causes 'Name Reponse is not Declared' to display and the project will not compile.
Looking at article I found here on Expert Exchange, I attempted the following code:
Dim app As HttpApplication
app.Context.Response.Write ("<script> window.ope n('" & HttpPath & "',target='_blank');</scri pt>")
This statement fails saying that app is a null reference.
I just can't seem to win here!
Can someone please tell me how to accomplish, what seems like should be, this simple task.
Thank you, Herb
Response.Write("<script>wi
This causes 'Name Reponse is not Declared' to display and the project will not compile.
Looking at article I found here on Expert Exchange, I attempted the following code:
Dim app As HttpApplication
app.Context.Response.Write
This statement fails saying that app is a null reference.
I just can't seem to win here!
Can someone please tell me how to accomplish, what seems like should be, this simple task.
Thank you, Herb
ASKER
That sounds easy enough. Can you give me an idea of what the code would look like to call the class?
I should think that the function I am calling within the class would look something like this:
Public Shared Sub generateTechEvalReport(ByV al app As HttpApplication)
But what does the code look like to call this?
generateTechEvalReport(?)
I should think that the function I am calling within the class would look something like this:
Public Shared Sub generateTechEvalReport(ByV
But what does the code look like to call this?
generateTechEvalReport(?)
You can even just pass the response object.
My example is in C#, but this should give you an idea
ombbt is a class that needs to use the response object
ombbt.GenerateReport(Respo nse);
public void GenerateReport(HttpRespons e parentResponse)
My example is in C#, but this should give you an idea
ombbt is a class that needs to use the response object
ombbt.GenerateReport(Respo
public void GenerateReport(HttpRespons
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hot dam... you don't know how long I've been trying to figure this out. It's been frustrating.
Thanks for coming through. This will help me a lot!
One quick follow up question... I noticed that when I do the response.write to open a new window and display the report that the webpage in the existing window of my application gets distorted by way of the images and text being larger.
Any idea why that happens?
Thanks again.. Herb
Thanks for coming through. This will help me a lot!
One quick follow up question... I noticed that when I do the response.write to open a new window and display the report that the webpage in the existing window of my application gets distorted by way of the images and text being larger.
Any idea why that happens?
Thanks again.. Herb
sorry, not sure why the distortion.
Glad that helped.
Dan
Glad that helped.
Dan
By doing this, you get the current context of the response object.