Click here to Skip to main content
15,896,727 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: .NET Pin
senthilsstil22-Nov-07 1:54
senthilsstil22-Nov-07 1:54 
QuestionOnline conference Pin
SreejithAchutan21-Nov-07 21:30
SreejithAchutan21-Nov-07 21:30 
AnswerRe: Online conference Pin
N a v a n e e t h21-Nov-07 22:01
N a v a n e e t h21-Nov-07 22:01 
GeneralOnline conference Pin
SreejithAchutan21-Nov-07 22:11
SreejithAchutan21-Nov-07 22:11 
AnswerRe: How we use any Rich Text Editor as a control in c# web Project Pin
N a v a n e e t h21-Nov-07 22:09
N a v a n e e t h21-Nov-07 22:09 
QuestionCombo box in Datagrid Pin
Rock Star.21-Nov-07 20:57
Rock Star.21-Nov-07 20:57 
AnswerRe: Combo box in Datagrid Pin
_AK_21-Nov-07 20:58
_AK_21-Nov-07 20:58 
Questionhelp in downloading file from server. Pin
serene joey21-Nov-07 20:48
serene joey21-Nov-07 20:48 
I have no problem uploading the file. and below is the code.

protected void uploadFile()<br />
    {<br />
        String projectID = (String)Session["projId"];<br />
        //change the file name<br />
        if (!FileUpload.FileName.Equals(""))<br />
        {<br />
            String fileName = FileUpload.FileName.Replace(FileUpload.FileName, "myDesiredFileName");<br />
            String extension = FileUpload.FileName.Substring(FileUpload.FileName.LastIndexOf("."));<br />
            // Create a new folder in Docs folder (folder name = projectID)<br />
            System.IO.Directory.CreateDirectory(Server.MapPath("Docs/") + projectID);<br />
<br />
            // Save the file into the new folder.<br />
            FileUpload.PostedFile.SaveAs(Server.MapPath("Docs/" + projectID + "/" + fileName + extension));<br />
<br />
        }<br />
    }//end of method


Now I need to provide a link to download the file.(the file extension is unknown, it could be .doc,.xls.pdf)

Below is my code. But it's not redirected.

    protected void btnLink_OnClientClick(object sender, EventArgs e)<br />
    {<br />
        String pid = Convert.ToString(Session["pid"]);<br />
        String[] file = System.IO.Directory.GetFiles((Server.MapPath("Docs/")+ pid +"/"), "myDesiredFileName.*");<br />
Response.Redirect(file[0]);<br />
}


May I know how to make this work?

serene

AnswerRe: help in downloading file from server. Pin
Sun Rays21-Nov-07 21:04
Sun Rays21-Nov-07 21:04 
GeneralRe: help in downloading file from server. Pin
serene joey22-Nov-07 1:17
serene joey22-Nov-07 1:17 
Questionsaving a file using mouse right click Pin
rdvsharma21-Nov-07 20:47
rdvsharma21-Nov-07 20:47 
Questionproblem with form view Pin
mon***z21-Nov-07 20:46
mon***z21-Nov-07 20:46 
AnswerRe: problem with form view Pin
Big Ralph21-Nov-07 20:49
Big Ralph21-Nov-07 20:49 
GeneralRe: problem with form view Pin
mon***z21-Nov-07 21:11
mon***z21-Nov-07 21:11 
GeneralRe: problem with form view Pin
Big Ralph22-Nov-07 22:41
Big Ralph22-Nov-07 22:41 
Questionworking with datagrid Pin
rdvsharma21-Nov-07 20:35
rdvsharma21-Nov-07 20:35 
AnswerRe: working with datagrid Pin
John-ph22-Nov-07 0:32
John-ph22-Nov-07 0:32 
GeneralRe: working with datagrid Pin
rdvsharma22-Nov-07 14:55
rdvsharma22-Nov-07 14:55 
Questionremove sessions with javascript Pin
SamRST21-Nov-07 20:13
SamRST21-Nov-07 20:13 
AnswerRe: remove sessions with javascript Pin
John-ph21-Nov-07 20:37
John-ph21-Nov-07 20:37 
GeneralRe: remove sessions with javascript Pin
SamRST21-Nov-07 23:55
SamRST21-Nov-07 23:55 
GeneralRe: remove sessions with javascript Pin
John-ph22-Nov-07 0:16
John-ph22-Nov-07 0:16 
GeneralRe: remove sessions with javascript Pin
RichardGrimmer22-Nov-07 5:06
RichardGrimmer22-Nov-07 5:06 
GeneralRe: remove sessions with javascript Pin
SamRST23-Nov-07 21:11
SamRST23-Nov-07 21:11 
QuestionDatabase operation [modified] Pin
Dharti Gajjar21-Nov-07 19:28
Dharti Gajjar21-Nov-07 19:28 

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.