Click here to Skip to main content
15,885,365 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multi-Page TIFF support Pin
Jordy "Kaiwa" Ruiter29-Apr-10 3:24
Jordy "Kaiwa" Ruiter29-Apr-10 3:24 
GeneralRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 3:32
sitebuilderLuc Pattyn29-Apr-10 3:32 
GeneralRe: Multi-Page TIFF support Pin
Jordy "Kaiwa" Ruiter29-Apr-10 3:39
Jordy "Kaiwa" Ruiter29-Apr-10 3:39 
GeneralRe: Multi-Page TIFF support Pin
Luc Pattyn29-Apr-10 3:51
sitebuilderLuc Pattyn29-Apr-10 3:51 
QuestionIs it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Puneet Bhatnagar28-Apr-10 22:49
Puneet Bhatnagar28-Apr-10 22:49 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Gaurav Dudeja India28-Apr-10 22:57
Gaurav Dudeja India28-Apr-10 22:57 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
Matt Meyer29-Apr-10 6:12
Matt Meyer29-Apr-10 6:12 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar [modified] Pin
Covean29-Apr-10 0:18
Covean29-Apr-10 0:18 
If you are using ASP.NET you can create an aspx site where you check if the user
has the right to download/see the pdf (maybe through a temp guid). If he has the right, then you can
send this pdf through the response stream to the client pc.

Example:

.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetPDF.aspx.cs" Inherits="[namespace].GetPDF" %>



.cs
public partial class GetPDF : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            // check access rights or guid

            Response.Clear();

            // read pdf (hosted on server site) trough binary stream to a byte array buffer

            Response.ContentType = "application/pdf";
            Response.BufferOutput = true;
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetNoStore();
            Response.OutputStream.Write(buffer, 0, buffer.Length);
        }
        catch (Exception)
        {
        }
    }
}


Maybe the user sees the url "http://.../GetPDF.aspx?querystring" but through your check, copy and paste the url
will not work. (You could create a temp guid to access the pdf for the user, provide it in the querystring and delete
this temp guid after downloading. On the next call of this url the user will not be able to download it again.)


Hope this helps.


Edit:

In addition to the example above, you can also use the session object to check if the user has the rights to access the pdf file. Just set a session value (like Session["UserCanAccessPDF"] = true;) on link click event and check this session value on GetPDF::Page_Load. If the session value is invalid or not set, just redirect to an error page (or something else). If the value is valid, send the pdf trough the stream and delete the session value.
Greetings
Covean
modified on Thursday, April 29, 2010 7:01 AM

AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
AspDotNetDev29-Apr-10 10:42
protectorAspDotNetDev29-Apr-10 10:42 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
PunkIsNotDead29-Apr-10 17:18
PunkIsNotDead29-Apr-10 17:18 
GeneralRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
AspDotNetDev29-Apr-10 17:25
protectorAspDotNetDev29-Apr-10 17:25 
AnswerRe: Is it Possible to download a pdf file from a web page without showing the URL of pdf file in address bar Pin
PunkIsNotDead29-Apr-10 17:35
PunkIsNotDead29-Apr-10 17:35 
QuestionClearing an array of images Pin
Wamuti28-Apr-10 22:23
Wamuti28-Apr-10 22:23 
AnswerRe: Clearing an array of images Pin
Mycroft Holmes28-Apr-10 23:37
professionalMycroft Holmes28-Apr-10 23:37 
AnswerRe: Clearing an array of images Pin
Luc Pattyn29-Apr-10 1:07
sitebuilderLuc Pattyn29-Apr-10 1:07 
AnswerRe: Clearing an array of images Pin
AspDotNetDev29-Apr-10 11:54
protectorAspDotNetDev29-Apr-10 11:54 
QuestionEvery possible group of items in an array/set/... [SOLVED] Pin
Bart Van Eyndhoven28-Apr-10 21:59
Bart Van Eyndhoven28-Apr-10 21:59 
GeneralRe: Every possible group of items in an array/set/... Pin
harold aptroot28-Apr-10 22:09
harold aptroot28-Apr-10 22:09 
GeneralRe: Every possible group of items in an array/set/... Pin
Bart Van Eyndhoven28-Apr-10 22:59
Bart Van Eyndhoven28-Apr-10 22:59 
GeneralRe: Every possible group of items in an array/set/... Pin
Alan Balkany29-Apr-10 4:00
Alan Balkany29-Apr-10 4:00 
AnswerRe: Every possible group of items in an array/set/... Pin
PIEBALDconsult29-Apr-10 3:45
mvePIEBALDconsult29-Apr-10 3:45 
GeneralRe: Every possible group of items in an array/set/... Pin
Bart Van Eyndhoven29-Apr-10 22:21
Bart Van Eyndhoven29-Apr-10 22:21 
GeneralRe: Every possible group of items in an array/set/... Pin
harold aptroot29-Apr-10 6:01
harold aptroot29-Apr-10 6:01 
AnswerRe: Every possible group of items in an array/set/... Pin
Kythen29-Apr-10 6:44
Kythen29-Apr-10 6:44 
QuestionExcel Interop Pin
nuonxxx28-Apr-10 21:27
nuonxxx28-Apr-10 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.