Download file from another server

H

Hemant

Hi ,

I am working on C# in Asp.net 2.0 .
I have to downlaod file from another server .
If i wirte Server.mappath("") It gives me local path.
I want to access that server from my application server to get that file.

please help me.

Thanks,
Hemant
 
M

Mark Rae [MVP]

I am working on C# in ASP.NET 2.0.
I have to downlaod file from another server.
OK.


If I write Server.mappath("") It gives me local path.

Yes, it would.

I want to access that server from my application server to get that file.

This is a networking question - nothing to do with ASP.NET per se..

You need to set up some means of communication between the webserver on
which ASP.NET is running and the remote server with the file that you
require. How you do this will largely depend on the location of the remote
server in relation to the webserver.

If it's on the same network, you can almost certainly connect to it with
standard networking protocols, e.g.
\\<remoteserver>\<remoteshare>\remotefile.txt - obviously, the account under
with your ASP.NET app is running will need sufficient permission...

Alternatively, if it's out on the web somewhere, you might have to use FTP
or similar...
 
H

Hemant

Thanks,

Both servers are on the same network.
When I run my application with localhost+Port number than it can access that
server but if use only localhost means by creating a virtual directory in
IIS and running through that virtual directory I am not able to access that
file.
Can you please tell me the issue.

Thanks,
Hemant Patnecha
 
M

Mark Rae [MVP]

[please don't top-post]
Both servers are on the same network.
When I run my application with localhost+Port number than it can access
that server but if use only localhost means by creating a virtual
directory in IIS and running through that virtual directory I am not able
to access that file.
Can you please tell me the issue.

As I said, this is a networking question, and nothing to do with ASP.NET...

If the ASP.NET app running on a webserver needs to access a file on another
internal server in the same network, then the network admin will need to
enable sufficient permissions on the account under which the ASP.NET app is
running...
 
H

Hemant

Hi,

Thank you
but here is solution :
I have to write following line in web.config
<identity impersonate="true" userName="" password="" />

and this solved my problem.



Thanks,

Hemant

Mark Rae said:
[please don't top-post]
Both servers are on the same network.
When I run my application with localhost+Port number than it can access
that server but if use only localhost means by creating a virtual
directory in IIS and running through that virtual directory I am not able
to access that file.
Can you please tell me the issue.

As I said, this is a networking question, and nothing to do with
ASP.NET...

If the ASP.NET app running on a webserver needs to access a file on
another internal server in the same network, then the network admin will
need to enable sufficient permissions on the account under which the
ASP.NET app is running...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top