Click here to Skip to main content
15,887,871 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionCreate Button at runtime! Pin
Sr...Frank19-Dec-09 5:01
Sr...Frank19-Dec-09 5:01 
AnswerRe: Create Button at runtime! Pin
dan!sh 19-Dec-09 5:40
professional dan!sh 19-Dec-09 5:40 
GeneralRe: Create Button at runtime! Pin
Sr...Frank19-Dec-09 5:49
Sr...Frank19-Dec-09 5:49 
GeneralRe: Create Button at runtime! Pin
dan!sh 19-Dec-09 6:09
professional dan!sh 19-Dec-09 6:09 
GeneralRe: Create Button at runtime! Pin
Sr...Frank19-Dec-09 6:15
Sr...Frank19-Dec-09 6:15 
GeneralRe: Create Button at runtime! Pin
dan!sh 19-Dec-09 6:47
professional dan!sh 19-Dec-09 6:47 
AnswerRe: Create Button at runtime! Pin
Abhishek Sur19-Dec-09 10:26
professionalAbhishek Sur19-Dec-09 10:26 
QuestionUpload Image on server using webclient Pin
mohdjaved119-Dec-09 3:38
mohdjaved119-Dec-09 3:38 
I want to upload Image on server using webclient. i write this code its working on local server. but not working on myweb server. please give me a correct answer.

Dim imgpath As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg"
Dim ipath As String = Server.MapPath("Images")
Dim a() As String = Split(imgpath, "\")
UploadPath1.Text = ipath & "/" & a(a.Length - 1)
webClient.UploadFile(ipath & "/" & a(a.Length - 1), "Post", imgpath)

its give error


Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.

Source Error:


Line 17: Dim client As New Net.WebClient
Line 18: client.Credentials = Net.CredentialCache.DefaultNetworkCredentials
Line 19: client.UploadFile(ipath & "/" & a(a.Length - 1), "Post", imgpath)
Line 20: client.Dispose()
Line 21: End Sub


Source File: D:\Webserver\aksinfotech.in\www\UploadImage\Default.aspx.vb Line: 19

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\All Users\Documents\My Pictures\Sunset.jpg'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +193
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +67
System.Net.WebClient.OpenFileInternal(Boolean needsHeaderAndBoundary, String fileName, FileStream& fs, Byte[]& buffer, Byte[]& formHeaderBytes, Byte[]& boundaryBytes) +203
System.Net.WebClient.UploadFile(Uri address, String method, String fileName) +253

[WebException: An exception occurred during a WebClient request.]
System.Net.WebClient.UploadFile(Uri address, String method, String fileName) +538
System.Net.WebClient.UploadFile(String address, String method, String fileName) +27
_Default.Upload_Click(Object sender, EventArgs e) in D:\Webserver\aksinfotech.in\www\UploadImage\Default.aspx.vb:19
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
AnswerRe: Upload Image on server using webclient Pin
Abhijit Jana20-Dec-09 3:58
professionalAbhijit Jana20-Dec-09 3:58 
QuestionSplit string problem Pin
lrsalunkhe19-Dec-09 1:01
lrsalunkhe19-Dec-09 1:01 
AnswerRe: Split string problem Pin
saini arun19-Dec-09 1:13
saini arun19-Dec-09 1:13 
GeneralRe: Split string problem Pin
lrsalunkhe19-Dec-09 1:22
lrsalunkhe19-Dec-09 1:22 
GeneralRe: Split string problem Pin
#realJSOP20-Dec-09 1:25
mve#realJSOP20-Dec-09 1:25 
QuestionWeb Service Pin
ellllllllie18-Dec-09 22:35
ellllllllie18-Dec-09 22:35 
AnswerRe: Web Service Pin
Brij19-Dec-09 2:42
mentorBrij19-Dec-09 2:42 
GeneralRe: Web Service Pin
ellllllllie19-Dec-09 4:01
ellllllllie19-Dec-09 4:01 
Questioncompress webrespource.axd file in ii7 Pin
Vijay31aug18-Dec-09 22:30
Vijay31aug18-Dec-09 22:30 
QuestionUpdatepanel not working in createuser wizard Pin
bhavnvyas18-Dec-09 20:54
bhavnvyas18-Dec-09 20:54 
AnswerRe: Updatepanel not working in createuser wizard Pin
Abhijit Jana18-Dec-09 23:14
professionalAbhijit Jana18-Dec-09 23:14 
GeneralRe: Updatepanel not working in createuser wizard Pin
bhavnvyas18-Dec-09 23:56
bhavnvyas18-Dec-09 23:56 
GeneralRe: Updatepanel not working in createuser wizard Pin
saini arun19-Dec-09 0:12
saini arun19-Dec-09 0:12 
Question[Message Deleted] Pin
4anusha418-Dec-09 20:49
4anusha418-Dec-09 20:49 
AnswerRe: Class Library Pin
m-khansari18-Dec-09 21:21
m-khansari18-Dec-09 21:21 
AnswerRe: Class Library Pin
saini arun18-Dec-09 21:23
saini arun18-Dec-09 21:23 
AnswerRe: [Message Deleted] Pin
sashidhar18-Dec-09 22:45
sashidhar18-Dec-09 22:45 

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.