473,323 Members | 1,589 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,323 software developers and data experts.

Problems with blank window appearing after displaying a document

RE: from Displaying a Document using the ASPNET user account to the Client Browser discussion (3/2/2004

Buddy
Thanks for helping me on getting the document to display. But now I am left with a second issue. While I was displaying the document as an attachment I end up with an extra window open or if I remove the Target='_blank' then my main window goes blank
What I am doing is using the base code from http://www.eggheadcafe.com/articles/20021207.asp that I used to help me transfer my Classic Session Variables from the base ASP code to the ASP.NET code which actually does the "viewdocument.aspx" work. My problem is that when I pass from main.asp->ASPTOASPX.asp->viewdocument.aspx I then get stuck with the blank window. I have tried using Redirects and Server.Transfers at the bottom of the page. But the code appears to freeze up after the document gets displayed. Any thoughts

<%@ Page ASPCompat="true" %><%@ Import Namespace="System.IO" %><%@ Import Namespace="System" %><%@ Import Namespace="System.net" %><%@ Import Namespace="System.text" %><%@ Import Namespace="System.Data.SqlClient" %><
Dim strdoc, objRS, objConn, strdoctype, objRS
Dim strSQL as StringBuilde
Dim strSQLC as StringBuilde
Dim FileName as StringBuilde

strdoc = Session("Parm1"

'1- Get file informatio
Dim conPubs as SqlConnectio
Dim cmdSelect as SqlComman
Dim dtrSelect as SqlDataReade
Dim conPubsC as SqlConnectio
Dim cmdSelectC as SqlComman
Dim dtrSelectC as SqlDataReade

conPubs = New SqlConnection( ---------

conPubs.Open(
strSQL = new System.Text.StringBuilder(
strSQL.Append("Select query"

cmdSelect = New SqlCommand(strSQL.ToString(), conPubs
dtrSelect = cmdSelect.ExecuteReader(
While dtrSelect.Read(

'2- Validate that the user can view this catagory of documen
if CheckAccess(dtrSelect("doccatagory"))="Y" the
conPubsC = New SqlConnection("-------"

conPubsC.Open(
'3- Get the ContentType information using the document's doctyp
strdoctype="." + dtrSelect("doctype"

' Retreive content type informatio
strSQLC = new System.Text.StringBuilder(
strSQLC.Append("Select * from ContentTypes where Class='"
strSQLC.Append(strdoctype
strSQLC.Append("'"
cmdSelectC = New SqlCommand(strSQLC.ToString(), conPubsC
dtrSelectC = cmdSelectC.ExecuteReader(
While dtrSelectC.Read(

'4- Only allow display of valid contenttypes
if dtrSelectC("status")="Y" the

Dim MyFileInfo As FileInf
Dim StartPos, FileSize As Lon
Dim header As String = "attachment;filename=Document1" & strdoctyp

FileName = new System.Text.StringBuilder(
FileName.Append("f:\inetpub\"
FileName.Append(dtrSelect("filename")
FileName.Append("/"
FileName.Append(dtrSelect("doccatagory")
FileName.Append("/"
FileName.Append(dtrSelect("docnumber")
FileName.Append("."
FileName.Append(dtrSelect("doctype")

MyFileInfo = New FileInfo(FileName.ToString()
FileSize = MyFileInfo.Length
response.contenttype = dtrSelectC("ContentType"
Response.AddHeader("Content-Disposition",header
Response.WriteFile(FileName.ToString(), StartPos, FileSize
End if 'End of Valid ContentTyp

End Whil
dtrSelectC.Close(
conPubsC.Close(
End if 'End of Check Access allowe

End Whil
dtrSelect.Close(
conPubs.Close(

'RetPage is the variable containing the original UR

Session("DestPage")=Session("RetPage"
Server.Transfer("ASPXTOASP.aspx"
%>
Jul 21 '05 #1
0 1545

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

Similar topics

0
by: Christopher Brandsdal | last post by:
Hi! I have a anoying problem with my editor! What i want to do is make a popup that holds a string for the "hyperlink" window... I have a popup to do this before, and it works perfecty, but in...
0
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4...
5
by: Scott | last post by:
I have a customer that had developed an Access97 application to track their business information. The application grew significantly and they used the Upsizing Wizard to move the tables to SQL...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
0
by: Wynter | last post by:
RE: from Displaying a Document using the ASPNET user account to the Client Browser discussion (3/2/2004 Buddy Thanks for helping me on getting the document to display. But now I am left with a...
2
by: suhy | last post by:
Hi All, I use bellow code for Auto-Sizing Image Popup Window. It seems that it just stop working OK with IE7 as I didn't make any changes ... In the FF2.0 it still works great. You can see the...
4
by: MarkKM | last post by:
Hello, I'm having troubles with IE7 and the window.location function in an SVG file. This all works fine in IE6 using the Adobe SVG viewer but not in IE7, WHY? Please HELP! We use IE in Kiosk...
3
by: neilfarah | last post by:
This is a xmlDoc.load routine through either IE or Firefox. An RSS URL is loaded into a form. After Onclick of a button a second window is launched and a parsed listing of the original RSS file is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.