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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem accessing a page from another server

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
We have three web servers that host our application. We synchronized these servers every night.
In the morning, we update a lot files in Server1 and can not afford to sync the other two servers with these updated files.
What I want to do is, regardless of what web server our user is connected to, I would want them to access the file in Server1.
I have this code that does not seem to work.
Any help will be greatly appreciated.

<%@ Language=VBScript %>
<% Response.Expires = -5000 %>

<%

'file = Request.querystring("file")
file = "somefile.htm"
filePath = "//Server1/some directory/"

filedir = filePath & file

%>

<HTML>
<body OnLoad="showfile()">
<SCRIPT LANGUAGE=javascript>
//<!--

function showfile()
{

var filedir = '<%=filedir%>'

//alert(filedir)

url=filedir;
location.href=url

}
//-->
</SCRIPT>

</body>
</html>
 
Why don't you use Response.Redirect? What you have should work on an intranet, but not over the Internet. Is that what you want?

Lee
 
Thanks for the response.

I have not resolved establishing trust between servers, that Response.Redirect will prompt our user for another login to the other server, and this is what I am trying to avoid at this time.

In the above asp page, I have an include file that I define the filePath. It is something like this:

filePath = "//Server1/some dir/sub dir/"

I use this filePath to access an Access DB in this server as well, like this which works fine:

DBdir = filePath & "AccDB.mdb"

The above asp page worked after I created and use a new path variable:

filePath1 = "//Server1/sub dir/"
filedir = filePath1 & file

which puzzles me.






 
It looks like you are using brower-side code to pull the remote file.


If the MDB file is reached like this via a UNC path, the security involved is most likely Windows Active Directory security between the machine where the browser is running and the machine hosting the file.

However when you involve a [tt]Redirect[/tt] or [tt]location.href[/tt] now you've also got the security of the web server it on the action.
 
I believe I spoke to soon.
The asp worked but I still get prompted for another login to Server1. This is what I am trying to avoid.

Is it possible to get the file from Serveri and open it in Server2 thru asp?
 
A Response.Redirect from ASP is a message from the web server to the browser that the request resource is now at a different location. Unless the user's browser security is set very high, this will cause browser to issue another HTTP request to the newly specified location without the user even knowing what happened.

Setting location.href in browser-side code does the same thing... it causes the browser to make a request to the specified location.

In neither case does the ASP go get the page so any security is between the browser, the newly specified web server, and that web server's filesystem.


If you want to avoid the browser machine negotiating security with the second server, perhaps the content from the second server can be funneled through the first server. This would be extra bandwidth for the first server, but it could do an end-around the security. Perhpas it could be accomplished as a virtual directory in IIS so that the browser is believes the files exist on the first server. This would cause the browser to silently send the same security credentials as it sends when requesting other resources on the first server. Another possibility might be to use an object like the server-safe version of XMLHTTP to request the file from the second server from within an ASP on the first server and then send the second server's response to the browser.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top