Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
Questionthe locations are different than the mouse locations.. Pin
prasadbuddhika23-Aug-10 5:31
prasadbuddhika23-Aug-10 5:31 
AnswerRe: the locations are different than the mouse locations.. Pin
OriginalGriff23-Aug-10 6:05
mveOriginalGriff23-Aug-10 6:05 
GeneralRe: the locations are different than the mouse locations.. Pin
prasadbuddhika23-Aug-10 6:11
prasadbuddhika23-Aug-10 6:11 
GeneralRe: the locations are different than the mouse locations.. Pin
Ennis Ray Lynch, Jr.23-Aug-10 6:24
Ennis Ray Lynch, Jr.23-Aug-10 6:24 
GeneralRe: the locations are different than the mouse locations.. Pin
Luc Pattyn23-Aug-10 6:31
sitebuilderLuc Pattyn23-Aug-10 6:31 
GeneralRe: the locations are different than the mouse locations.. Pin
OriginalGriff23-Aug-10 6:45
mveOriginalGriff23-Aug-10 6:45 
GeneralRe: the locations are different than the mouse locations.. Pin
Luc Pattyn23-Aug-10 7:15
sitebuilderLuc Pattyn23-Aug-10 7:15 
QuestionDownload file from server to local folder Pin
Agweet23-Aug-10 4:16
Agweet23-Aug-10 4:16 
Hi All,

i am trying to download a file from my website on my server, but i keep getting a error: Access to the path 'c:\ImageName.gif' is denied.

this is my code i am using:

<code>using (WebClient wcDownload = new WebClient())
{
try
{
webRequest = (HttpWebRequest)WebRequest.Create("http://www.XXXXXXXXXXX.XX.XX/Images/" + strImgName);
webRequest.Credentials = CredentialCache.DefaultCredentials;
webResponse = (HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;

strResponse = wcDownload.OpenRead("http://www.XXXXXXXXXXX.XX.XX/Images/" + strImgName);
string strFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

strLocal = new FileStream(strFolder + "\\" + strImgName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);

int bytesSize = 0;
byte[] downBuffer = new byte[2048];

while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
strLocal.Write(downBuffer, 0, bytesSize);
}

string strAlert = "alert('" + strImgName + " downloaded to " + strFolder + "');";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", strAlert, true);
}
finally
{
strResponse.Close();
strLocal.Close();
}
}</code>

Any help is much appreciated.

living life on the flip side
AnswerRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 4:18
sitebuilderLuc Pattyn23-Aug-10 4:18 
AnswerRe: Download file from server to local folder Pin
Pete O'Hanlon23-Aug-10 4:35
mvePete O'Hanlon23-Aug-10 4:35 
AnswerRe: Download file from server to local folder Pin
Agweet23-Aug-10 6:01
Agweet23-Aug-10 6:01 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 6:23
professionalRavi Bhavnani23-Aug-10 6:23 
GeneralRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 6:33
sitebuilderLuc Pattyn23-Aug-10 6:33 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 6:48
mveOriginalGriff23-Aug-10 6:48 
GeneralRe: Download file from server to local folder Pin
Agweet23-Aug-10 6:54
Agweet23-Aug-10 6:54 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 7:04
professionalRavi Bhavnani23-Aug-10 7:04 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani23-Aug-10 7:09
professionalRavi Bhavnani23-Aug-10 7:09 
GeneralRe: Download file from server to local folder Pin
Agweet23-Aug-10 20:14
Agweet23-Aug-10 20:14 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani24-Aug-10 5:20
professionalRavi Bhavnani24-Aug-10 5:20 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 8:20
mveOriginalGriff23-Aug-10 8:20 
GeneralRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 7:03
sitebuilderLuc Pattyn23-Aug-10 7:03 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 8:08
mveOriginalGriff23-Aug-10 8:08 
AnswerRe: Download file from server to local folder Pin
johannesnestler24-Aug-10 4:52
johannesnestler24-Aug-10 4:52 
QuestionUsing Details view Pin
Member 322226423-Aug-10 3:07
Member 322226423-Aug-10 3:07 
AnswerStop cross posting. PinPopular
Pete O'Hanlon23-Aug-10 3:16
mvePete O'Hanlon23-Aug-10 3:16 

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.