Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
AnswerRe: Database Login Pin
Nissim Salomon26-Aug-07 10:08
Nissim Salomon26-Aug-07 10:08 
QuestionHow do I re-create feature/control like Data Tips in Visual Studio .NET 2005 Pin
abbyjeet26-Aug-07 7:13
abbyjeet26-Aug-07 7:13 
QuestionGenetic Algorithm Pin
starist26-Aug-07 5:05
starist26-Aug-07 5:05 
AnswerRe: Genetic Algorithm Pin
Curtis Schlak.26-Aug-07 9:42
Curtis Schlak.26-Aug-07 9:42 
QuestionSystem.IO.Path Understanding [modified] Pin
adnanrafiq26-Aug-07 4:30
adnanrafiq26-Aug-07 4:30 
AnswerRe: System.IO.Path Understanding Pin
Mark Churchill26-Aug-07 4:48
Mark Churchill26-Aug-07 4:48 
GeneralRe: System.IO.Path Understanding Pin
adnanrafiq26-Aug-07 5:22
adnanrafiq26-Aug-07 5:22 
GeneralRe: System.IO.Path Understanding Pin
Mark Churchill26-Aug-07 19:41
Mark Churchill26-Aug-07 19:41 
Hi Adnan,

A handler can be made that will serve out many different files. I'm not going to write one for you, but I can give you some code snippets to give you an idea. (I'm also typing straight into the reply window, so they might be a little wrong).

Firstly you would need some way of identifying what file the user wants, and mapping that to a real file. Lets just assume they are all pdf files in one directory, and the user will ask for them by filename in the querystring (http://yoursite/getFile.ashx?SomeFileName).

So in our handler we can get the file the user wants with the Request.QueryString. Then we can check whether the user has permission to access the file (how you do this is up to you). Then we can send the file to the client.

We want to set the context.Response.ContentType = "text/pdf" (or whatever is appropriate).

We need to find the physical filename of the file, say string filename= "c:\\somedirectory\\" + filename + ".pdf". Then we can use context.Response.WriteFile(filename) to send the file to the client.

Note that you probably want to check the user's input more carefully than I have. Wink | ;)

Mark Churchill
Director
Dunn & Churchill

GeneralRe: System.IO.Path Understanding Pin
adnanrafiq27-Aug-07 19:47
adnanrafiq27-Aug-07 19:47 
Questiondebugging a windows service... how? Pin
swjam26-Aug-07 3:14
swjam26-Aug-07 3:14 
AnswerRe: debugging a windows service... how? Pin
PIEBALDconsult26-Aug-07 4:21
mvePIEBALDconsult26-Aug-07 4:21 
GeneralRe: debugging a windows service... how? Pin
swjam26-Aug-07 4:47
swjam26-Aug-07 4:47 
GeneralRe: debugging a windows service... how? Pin
PIEBALDconsult26-Aug-07 5:20
mvePIEBALDconsult26-Aug-07 5:20 
GeneralRe: debugging a windows service... how? Pin
Mark Churchill26-Aug-07 17:56
Mark Churchill26-Aug-07 17:56 
Questionmy form get lost focus in MultiThread mod. Pin
hdv21226-Aug-07 2:35
hdv21226-Aug-07 2:35 
QuestionSELECT COL1,COL2,SUM(COL1,COL2) AS COL3 FROM TEST; Pin
Muammar©26-Aug-07 1:15
Muammar©26-Aug-07 1:15 
AnswerRe: SELECT COL1,COL2,SUM(COL1,COL2) AS COL3 FROM TEST; Pin
Christian Graus26-Aug-07 1:28
protectorChristian Graus26-Aug-07 1:28 
GeneralRe: SELECT COL1,COL2,SUM(COL1,COL2) AS COL3 FROM TEST; Pin
Muammar©26-Aug-07 1:38
Muammar©26-Aug-07 1:38 
AnswerRe: SELECT COL1,COL2,SUM(COL1,COL2) AS COL3 FROM TEST; Pin
Luis Alonso Ramos26-Aug-07 6:52
Luis Alonso Ramos26-Aug-07 6:52 
QuestionSetup package Pin
justintimberlake25-Aug-07 23:03
justintimberlake25-Aug-07 23:03 
QuestionDataTable.DefaultView.Sort throwing out of memory exception Pin
michal.kreslik25-Aug-07 22:26
michal.kreslik25-Aug-07 22:26 
AnswerRe: DataTable.DefaultView.Sort throwing out of memory exception Pin
michal.kreslik26-Aug-07 20:01
michal.kreslik26-Aug-07 20:01 
GeneralRe: DataTable.DefaultView.Sort throwing out of memory exception Pin
michal.kreslik26-Aug-07 21:29
michal.kreslik26-Aug-07 21:29 
QuestionC# 2005 to VB.net 2005 project conversion? Pin
y2ktheory25-Aug-07 22:26
y2ktheory25-Aug-07 22:26 
AnswerRe: C# 2005 to VB.net 2005 project conversion? Pin
Christian Graus26-Aug-07 1:31
protectorChristian Graus26-Aug-07 1:31 

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.