473,513 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems opening document using response.redirect

2 New Member
Hi everyone,

I'm developing an application using ASP.NET with VB, connected to a SQL Server, running on .NET 2 framework.

I am developing a training system where documents are uploaded into the system and a test is defined.

The problem I am having is when users need to view these documents. Currently, they select which item they wish to complete training on, and by clicking the start test button, it pulls the location of this document from the database and adds this file location to a variable, before using response.redirect to open the document.

Response.Redirect(LocationOfDoc)

On completion, these files will be stored on a separate network drive to the webfiles, eg Q:\ therefore are currently stored in a directory on the development machines hard drive, C:\ .

However, instead of opening the document you get an 'Object moved here' error on firefox, or a page not found on IE. One thing I have noticed is that the drive letter, eg C is changed from uppercase to lowercase during the response.redeirect which seems to be causing the problem.

For example, in the database location might be:
C:\Documents and Settings\David\application\filestore\document\docu ment1
but by the time this has been through the response.redirect it ends up invalid as:
c:\Documents and Settings\David\application\filestore\document\docu ment1

I have found many different articles about known issues with various older browsers, or adding buffer = true etc but have had no luck yet.

If anyone has any further information on this it would be greatly received.
Nov 20 '08 #1
4 3435
balabaster
797 Recognized Expert Contributor
If you cut and paste that path into the browser address bar, does it open the file successfully?
Nov 20 '08 #2
Plater
7,872 Recognized Expert Expert
I would say the issues is the file does not exist on the client's computer (drive c:\) but on the server's computer (drive c:\) response.redirect will redirect to the exact string you pass it.
So the clients browser is told to look at a file on its own computer.


Consider using the response.WriteFile() (check msdn for correct usage)
Nov 20 '08 #3
dasnowball
2 New Member
If you cut and paste that path into the browser address bar, does it open the file successfully?
If you paste what is pulled from the database and put into the variable, the file opens fine. Its just as soon as it is used as response.redirect or as an asp hyperlink, the drive letter is changed from upper to lowercase and that is when you get the error.

Eg, response.redirect(LocationOfDocument)




I would say the issues is the file does not exist on the client's computer (drive c:\) but on the server's computer (drive c:\) response.redirect will redirect to the exact string you pass it.
So the clients browser is told to look at a file on its own computer.
All the files exist, and only one machine is currently being used for development - although are you saying that the 'client computer' and 'server computer' are acting as two machines which is why the browser can't find it? If I setup and mapped a network drive that is accessible to the client, would it be able to find it then? Or is there another way around this?

I will also look at the response.writefile option but ideally I would like the users to be able to open the file instead of printing it to the page.
Nov 20 '08 #4
Plater
7,872 Recognized Expert Expert
Well I was running under the following assumptions:
The webapplication was on computerA, and you were accessing it from a browser on computerB.
The files in question are on computerA with the webapplication, but NOT on computerB.
So when computerB tries to look for "c:\somedocument.doc", it doesn't exist because it is actually on computerA's c:\ drive.

I don't see why the difference between C:\ and c:\ would matter, but i suppose case-ing is important on some OSs
Nov 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5837
by: Jim Willis | last post by:
Hi, I have an application that returns a PDF document to the browser (not as a download). The document is returned in a new window. This works fine in most installations, but I have one...
55
4120
by: drhowarddrfine | last post by:
I'm working on a web site that could use some control using js but am concerned about what problems I may have with potential users having their js turned off. Has anyone had any serious problems...
1
4361
by: Walter Levine | last post by:
I just worked through a VB.Net sample program that creates an rft document and then opens it in Word. The code that opens the document is: Dim sFileName As String sFileName = "Sample1.doc" ...
8
3775
by: Cathie | last post by:
Hi guys, I want to do a Server.Transfer to get to a second page, so that I may retrieve variables I have set in the first page. I'm doing that with the usual Server.Transfer("pagename", true). ...
0
268
by: Novice | last post by:
Hi all, I'm a novice VB.NET and VBA programmer and am wondering if there is a tutorial out there on how to create a word document based on data in a database and then return that document to a web...
6
1953
by: Oliver | last post by:
I have a very wired problem requesting one specific url from within my application. I have struggeled with this for 5 hours now, and searched google withour any luck, so i hope that someone are...
1
5371
by: electrixnow | last post by:
Help!, I need to compile this code with static libs so it run on another XP machine that does'nt have MS Studio installed. When I compile now I get an ERROR: 1>------ Rebuild All started:...
9
11698
by: anuragsji | last post by:
Hi, I have one combo box and GO button on the click of GO button page submitted and according to selection of one of the option from combo I want to redirect my page to some new asp page but at...
0
3749
by: aarthiraaj | last post by:
In my user screen I have view link, if I click this link it will go to servlet and open one word document. It is opening properly, but while opening the attachment it generate one dialog box like...
0
7259
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
7380
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
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7523
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
5683
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,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.