I am trying to re-work a Visual Basic (ASP .NET 2.0) application that delivers a PDF to a user based on requests. I have the appropriate MIME type (Application/pdf) specified but need to open the pdf in a new browser window. Any ideas? I appreciate any and all input
Thanks
4 1514 kadghar 1,295
Recognized Expert Top Contributor
I am trying to re-work a Visual Basic (ASP .NET 2.0) application that delivers a PDF to a user based on requests. I have the appropriate MIME type (Application/pdf) specified but need to open the pdf in a new browser window. Any ideas? I appreciate any and all input
Thanks
i dont know if this works with .net, but with vb and vba i use shellexecute: - 'To declare it, copy and paste this:
-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
-
-
'To use it, this lines would do for a pdf:
-
-
a = ShellExecute 0, vbNullString, path & "file.pdf", vbNullString, vbNullString, vbNormalFocus
-
'Dont forget to declare variables
-
Hope that helps
i dont know if this works with .net, but with vb and vba i use shellexecute: - 'To declare it, copy and paste this:
-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
-
-
'To use it, this lines would do for a pdf:
-
-
a = ShellExecute 0, vbNullString, path & "file.pdf", vbNullString, vbNullString, vbNormalFocus
-
'Dont forget to declare variables
-
Hope that helps
Thanks .... will work with it over the weekend !
Thanks .... will work with it over the weekend !
-
Partial Class _Default
-
Inherits System.Web.UI.Page
-
'To declare it, copy and paste this:
-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
-
-
'To use it, this lines would do for a pdf:
-
-
Dim path As String = "C:\"
-
-
a = ShellExecute 0, vbNullString, path & "test.pdf", vbNullString, vbNullString, vbNormalFocus
-
-
End Class
-
I tried the above code .. received a 'declaration expected' message .. I feel stupid ... sure it's something that I am not seeing clearly ... :(
kadghar 1,295
Recognized Expert Top Contributor
Try declaring the function outside the class (before it starts)
I really dont know if shellexecute works the same way with .net, so may be thats the problem.
Good Luck
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Hemanth |
last post by:
Hello there,
I've a utility that runs on a linux machine. Basically, it opens
a window, draws a figure and captures the image (screen) and stores
it as a jpeg file. The utility requires a window to be open
(or displayed) inorder to save the image. Also, this utility is
in the form of an executable, so I can't possibly alter it.
I want to run this utility from a windows web browser and display
the saved jpeg file. I pass some command...
|
by: Bob |
last post by:
I am pretty new at C#, so bare with me. I want to be able to read a local HTML file and display it in a browser window within my application. I also want to submit that page to my application and generate a "Post" to a web server and read the contents back and display back into the same browser window in my application
I have found the methods HttpWebRequest and HttpWebResponse that allows me to read/write to the Web server, but I am not...
|
by: VMI |
last post by:
In my web app, how can I display an XML file in another browser window? Can
this be done with C#?
Thanks.
|
by: Tina |
last post by:
I'm in a button clicked event on mainpage.aspx. I want to display a new
webpage that has just my image, which is a jpg. I want the page to be a
..jpg not an aspx so that it will be easy for the user to save to disk.
How can I do this?
Thanks,
T
|
by: chazmanian |
last post by:
We have a situation where we display PDF files through IE via a method in our code-behind as follows
protected void displayPDF(string exePath, string filePath
{
// exePath is the Request.CurrentExecutionPath and we trim off the actual ASPX page designation an
// replace that with the "filePath" which represents the path and PDF that we want to display
string fullPath = exePath.Substring(0, exePath.LastIndexOf('/'))
fullPath += filePath...
| |
by: acool |
last post by:
I just plain forgot this setting and I have been all up and down the options
and nothing works, any hel is appreciated.
|
by: David Cho |
last post by:
I hope I can describe the dilemma precisely.
I have code to render PDF output in a browser window (using a third
party control that merges PDF files and renders the PDF output in the
browser window).
While rendering PDF in the browser window, I would also like to display
a message of some sort. But here is the problem.
Doing javascript alert window won't work because you cannot render HTML
|
by: tshad |
last post by:
This was posted before but the message got messed up (all NLs were stripped
out for some reason).
I have 2 labels that hold the name of different images on my .aspx page.
<asp:Label ID="Logo" runat="server"/>
<asp:Label ID="CompanyPicture" runat="server"/>
I have 2 links that open the windows to preview these images. The previewed
images are done on separate html pages that do nothing but display the
|
by: Safalra (Stephen Morley) |
last post by:
(Note: I'm not trying to do anything stupid based on the user's screen size
- I'm just curious.)
At work today I was looking at the visitor statistics for a client website,
and noticed that the recorded screen resolutions included results that
clearly referred to dual display systems - 2560 by 1024, for example. The
statistics package is obtaining this data from window.screen.width. I
wasn't aware of this behaviour of...
|
by: H. Rodriguez |
last post by:
Hello,
I would like to be able to open a new IE window on the client side and
display a PDF document in the new window. Many tutorial sites that I have
checked suggest opening a new IE window using client-side JavaScript and the
window.open() function. I suspect this is not the desired way as I would
like to output a PDF report from a byte array to the HTTP output stream to
this new window.
Any ideas?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |