473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

q; access to a remote file

\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}

Sep 23 '06 #1
7 1461
The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}

Sep 23 '06 #2
Thanks for the reply. Can you give me a site that shows how I can do it.

"John Timney (MVP)" wrote:
The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}



Sep 23 '06 #3
http://msdn.microsoft.com/library/de...ersonation.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
Thanks for the reply. Can you give me a site that shows how I can do it.

"John Timney (MVP)" wrote:
> The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or
bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}



Sep 24 '06 #4
Thanks John. I put the following lines into Web.config and got the following
error. Is there anything else I need to do? I am suing APS.Net 1.1.

<identity impersonate="true"
userName="domain\user"
password="password" />

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'identity'

=======

"John Timney (MVP)" wrote:
http://msdn.microsoft.com/library/de...ersonation.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
Thanks for the reply. Can you give me a site that shows how I can do it.

"John Timney (MVP)" wrote:
The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or
bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}



Sep 24 '06 #5
You have to actually give the entries values, like the domain your user is
from and the actual username, and their password. Did you make the mistake
of copying it verbatim.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E9**********************************@microsof t.com...
Thanks John. I put the following lines into Web.config and got the
following
error. Is there anything else I need to do? I am suing APS.Net 1.1.

<identity impersonate="true"
userName="domain\user"
password="password" />

Configuration Error
Description: An error occurred during the processing of a configuration
file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'identity'

=======

"John Timney (MVP)" wrote:
>http://msdn.microsoft.com/library/de...ersonation.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:80**********************************@microso ft.com...
Thanks for the reply. Can you give me a site that shows how I can do
it.

"John Timney (MVP)" wrote:

The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes
on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name
or
bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}




Sep 24 '06 #6
re:
I put the following lines into Web.config and got the following
error. Is there anything else I need to do? I am suing APS.Net 1.1.
Please don't sue ASP.NET 1.1... ;-)

Seriously, check to see if

<identity impersonate="true"
userName="domain\user"
password="password" />

is inside the <system.websection of web.config.

Also, check to see that it's not within another configuration section.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E9**********************************@microsof t.com...
Thanks John. I put the following lines into Web.config and got the following
error. Is there anything else I need to do? I am suing APS.Net 1.1.

<identity impersonate="true"
userName="domain\user"
password="password" />

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'identity'

=======

"John Timney (MVP)" wrote:
>http://msdn.microsoft.com/library/de...ersonation.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:80**********************************@microso ft.com...
Thanks for the reply. Can you give me a site that shows how I can do it.

"John Timney (MVP)" wrote:

The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or
bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}




Sep 24 '06 #7
Hi Juan, I would not but the while application is written in1.1, will there
be any problem if I convert it to 2.0?

"Juan T. Llibre" wrote:
re:
I put the following lines into Web.config and got the following
error. Is there anything else I need to do? I am suing APS.Net 1.1.

Please don't sue ASP.NET 1.1... ;-)

Seriously, check to see if

<identity impersonate="true"
userName="domain\user"
password="password" />

is inside the <system.websection of web.config.

Also, check to see that it's not within another configuration section.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E9**********************************@microsof t.com...
Thanks John. I put the following lines into Web.config and got the following
error. Is there anything else I need to do? I am suing APS.Net 1.1.

<identity impersonate="true"
userName="domain\user"
password="password" />

Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Unrecognized configuration section 'identity'

=======

"John Timney (MVP)" wrote:
http://msdn.microsoft.com/library/de...ersonation.asp

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
Thanks for the reply. Can you give me a site that shows how I can do it.

"John Timney (MVP)" wrote:

The asp.net account must be a domain account to access UNC paths, so
impersonate a domain user who has access to both the server your codes on
and the one you wish to access.

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"JIM.H." <JI**@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
\\MyRemoteServer\F1\F2\F3\This PDF.pdf is accessible thought my IE
browser,
so my user has access there.
However the following code gives "Logon failure: unknown user name or
bad
password.\r\n"
I need to get this application run under a user that has access to
MyRemoteServer, how should I do this?

void dDialog(string sPath)
{

sPath="\\\\MyRemoteServer\\F1\\F2\\F3\\This PDF.pdf";
System.IO.FileInfo oFile;
try
{
oFile = new System.IO.FileInfo(sPath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
oFile.Name);
Response.AddHeader("Content-Length", oFile.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(oFile.FullName);
}
catch (Exception ex)
{
Response.Write("Exception: " + ex.Message);
}
finally
{
Response.End();
}
}




Sep 27 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rene' Nielsen | last post by:
Context: Running Windows 2003 Server on an intranet. A web is configured with an anonymous access account that is a domain account that has been granted the desired access to a file on another...
6
by: John | last post by:
Hi We have an access app (front-end+backend) running on the company network. I am trying to setup replication for laptop users who go into field and need the data synched between their laptops...
56
by: Raphi | last post by:
Hi, I've been using an Access application I wrote for an office with the front-end stored on all computers and the back-end on one of them serving as an Access file server. Now we're moving...
3
by: Lyle Fairfield | last post by:
In a recent thread there has been discussion about Data Access Pages. It has been suggested that they are not permitted on many or most secure sites. Perhaps, that it is so, although I know of no...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
3
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer...
1
by: Duffman | last post by:
Hi, I have what seems to be a common problem, but the solutions I've found don't seem to work. I would like to use a web service to create a file at a UNC location in a shared file. Currently...
13
by: Bob Palank | last post by:
Remote server hosts a .mdb file but the client cannot access the DB through VB.Net Express 2005. My Assumptions: 1. One can use VB.Net Express 2005 to write a client resident application to...
1
by: TerrenceJ | last post by:
Hi there I've configure our SBS 2003 server to allow remote access and Outlook over internet. The mail works fine, but when I try remote access, I am asked for username and password, which I...
7
by: =?Utf-8?B?a21jY29za2V5?= | last post by:
I'm trying to access an access database on the file server from a web server using asp.net and IIS 6.0. I can do it when I have anonymous access enabled in IIS 6.0 as in the public internet web...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.