Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access other servers through asp

Status
Not open for further replies.

GandhiII

IS-IT--Management
Feb 23, 2002
37
DE
Hello experts!
I need an ASP-script that can read text files from a different server within my network.
Any hints are welcome!
 
I use an asp-page to start a scripted application on my webserver. I access this page through http. At the moment I read commands for this script from the same server and write logfiles also to this server. My aim is to make it possible to put commands on some network drives so my script can use them and write the logfiles there, too.
 
Try this... I don't know if this will work or not. You'll need to enable the Internet Guest account or the "Guest" account access to the share of your network server.

<%
Dim objFSO, objFile, strFileName
strFileName = &quot;\\someserver\sharename\filename.txt&quot;
Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objFile = objFSO.OpenTextFile(strFileName, 1, True)
Response.Write objFile.ReadAll
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
%>
 
Thanks baddos! You helped me pin my problem. I cannot use any guest account cause there is none on the servers I need. I would like to use the account of the user that opens the asp page and without any further authentication if possible. Something like a &quot;net use&quot; within asp where the windows authentication is used.
 
You can through this script into a virtual directory on your website. Disable anonymous access to that directory, and only allow the Integrated Windows authentication. This will force a Windows login dialog box and will log in that person w/ their NT credentials.

-Bad Dos
 
The asp-page is in a virtual directory and I use win2000 authentication to allow users to get there in the first place. But how do I authentify my script/my webserver on the other server?
 
Is the webserver and the file server in the same domain? If not, make a user w/ the same name and password that is on both boxes and NT will handle the rest.
 
Unfortunately I only have administrative rights on my webserver and not within the company network or any other servers.
I asked the admins to create a service user that has rights on the server I need to write to. But I don´t know how to use &quot;Mr Service&quot; or how to get along without him.
Thanks for your patience!
 
Just have them create a user that can read and write on the shares you need. Then create that username and password on your webserver and setup your website's anonymous access to use that username/password.
 
Can I still use the windows authentication to allow the users to call the asp-page in the first place?
 
I don't think you can mix your Authentications. If your using NT Authentication to logon to the website then those peopl ethat logon will need to have access to the network. If your using anonymous access (possibly with a db driven login) than you can set the default user for the site to your &quot;Mr Service&quot; user that has access (you should be able to set this user as default in the permissions section of your default web properties instead of the standard internet user they use).

-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top