|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
print page script - login problems
I have inherited a site written in 'classic' ASP, and I am working with a print page script. I've gotten the script to work ok, although, as the page which has the "print this page" link is 'protected,' the page that pops up (when the "print this page" linked is clicked) is the authentication page, rather than the page which is supposed to be printed. The URL that appears in the in the "print this page" link is the correct one (the page exists within a protected folder, although even when logged on successfully, the correct page will not appear). Thanks for any help you can provide. Here is the code I used. The top of the two codes listed is the 'calling' page in which the "print this page" link is located. <%Session.Timeout=200%> <%if Session("AMSADMINusername") <> "" then Session("AMSCOMMusername")= Session("AMSADMINusername") end if%> <%if isempty(Session("AMSCOMMusername")) then Response.Redirect "/ams/index.asp" end if%> <%role="comms"%> <html> <head></head> <body> <!--code below in body of calling page --> <script Language="JavaScript"> <!-- hide from old browsers // ppb and ppe are the start and end of the dynamic link // window.location.href will refer to the current URL of the page // it's nice to make it open in a new window too! i.e. target=_blank var ppb = "<a href=/print/printpage.asp?ref="; var ppe = " target=_blank>Print This Page</a><br>"; document.write(ppb + window.location.href + ppe); //end --> </script> <%breadcrumb="main menu"%> <!--#include virtual="/ams/common/layout/headerComm.asp"--> <!--<h3 align="left">Task Assigned:</h3> <p align="left">Dear Curriculum Committee Members, <br> Please review the reports under View Courses Under Review link below by July 21. <em>Posted July 7, 2005.</em></p> <br>--> <!--#include virtual="/ams/common/incSearchByKeywordGUI.asp"--> <!--#include virtual="/common/Layout/footer_training_ams_b.asp"--> <!--#include virtual="/common/Layout/footerams.htm"--> ----------------------------------------------------------------------------------------------------------------- <!-- code below in print page --> <% option explicit Response.Buffer = True 'declare a variable for the reference page, 'the XMLHTTP Object, and the regular expressions used Dim RefPage, objXMLHTTP, RegEx 'set the RefPage variable to the "ref" querystring 'the JavaScript function above passes the current page URL 'You can use the Request.ServerVariables("HTTP_REFERER") to 'get the page as a last option if needed RefPage = Request.QueryString("ref") if RefPage = "" then response.write "<h3>Invalid reference page</h3>" response.end end if 'set the objXMLHTTP object to the XMLHTTP object from Microsoft Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") 'perform the HTTP "GET" method via the XMLHTTP object to retrieve 'the called page objXMLHTTP.Open "GET", RefPage, False objXMLHTTP.Send 'give RefPage the text(HTML) from the call above RefPage = objXMLHTTP.responseText 'Create built In Regular Expression object that 'is now included with VBScript version5 Set RegEx = New RegExp RegEx.Global = True 'Set the pattern To look For <!-- START PPOMIT --> tags RegEx.Pattern = "<!-- START PPOMIT -->" 'replace the comment pattern with a rare ASCII character 'i've choosed No 253 in this case, I suppose if you're speaking 'a language other than English this may not be the case but 'the reasoning here is so it will be unique and not interfere 'this the main page content RefPage = RegEx.Replace(refpage,( chr(253) )) 'Set the pattern To look For <!-- END PPOMIT --> tags RegEx.Pattern = "<!-- END PPOMIT -->" 'This time make it replace the comment with another rare 'ASCII character, NOT the one used above RefPage = RegEx.Replace(refpage,( chr(254) )) 'Use this regular expression to "cut out" HTML between the 'start and end comments now the new ASCII characters RegEx.Pattern = chr(253) & "[^" & chr(254) & "]*" & chr(254) 'This will perform the actual striping RefPage = RegEx.Replace(refpage, " " ) 'Don't forget to tidy up :-) Set RegEx = Nothing Set objXMLHTTP = Nothing 'Output your Printer Friendly Page! Response.Write RefPage %> Instead of all that, why don't you throw a little JavaScript onto your
webpage: <input type="button" value="Print" onClick="parent.print()"> One simple line. Will that work? Show quote "ll" <barn104_1***@yahoo.com> wrote in message news:1193861122.254895.48090@k79g2000hse.googlegroups.com... > Hi, > I have inherited a site written in 'classic' ASP, and I am working > with a print page script. I've gotten the script to work ok, > although, as the page which has the "print this page" link is > 'protected,' the page that pops up (when the "print this page" linked > is clicked) is the authentication page, rather than the page which is > supposed to be printed. The URL that appears in the in the "print > this page" link is the correct one (the page exists within a protected > folder, although even when logged on successfully, the correct page > will not appear). Thanks for any help you can provide. > Show quote
On Oct 31, 3:25 pm, "jp2code" <poojo.com/mail> wrote: Well, there are some elements that need to be resized for print. I> Instead of all that, why don't you throw a little JavaScript onto your > webpage: > > <input type="button" value="Print" onClick="parent.print()"> > > One simple line. Will that work? > > "ll" <barn104_1***@yahoo.com> wrote in message > > news:1193861122.254895.48090@k79g2000hse.googlegroups.com... > > > Hi, > > I have inherited a site written in 'classic' ASP, and I am working > > with a print page script. I've gotten the script to work ok, > > although, as the page which has the "print this page" link is > > 'protected,' the page that pops up (when the "print this page" linked > > is clicked) is the authentication page, rather than the page which is > > supposed to be printed. The URL that appears in the in the "print > > this page" link is the correct one (the page exists within a protected > > folder, although even when logged on successfully, the correct page > > will not appear). Thanks for any help you can provide. might try that route and see what happens. Gazing into my crystal ball I observed ll <barn104_1***@yahoo.com>
Show quote writing in news:1193863275.974549.80200@d55g2000hsg.googlegroups.com: <style type="text/css">> On Oct 31, 3:25 pm, "jp2code" <poojo.com/mail> wrote: >> Instead of all that, why don't you throw a little JavaScript onto your >> webpage: >> >> <input type="button" value="Print" onClick="parent.print()"> >> >> One simple line. Will that work? >> >> "ll" <barn104_1***@yahoo.com> wrote in message >> >> news:1193861122.254895.48090@k79g2000hse.googlegroups.com... >> >> > Hi, >> > I have inherited a site written in 'classic' ASP, and I am working >> > with a print page script. I've gotten the script to work ok, >> > although, as the page which has the "print this page" link is >> > 'protected,' the page that pops up (when the "print this page" linked >> > is clicked) is the authentication page, rather than the page which is >> > supposed to be printed. The URL that appears in the in the "print >> > this page" link is the correct one (the page exists within a protected >> > folder, although even when logged on successfully, the correct page >> > will not appear). Thanks for any help you can provide. > > > > Well, there are some elements that need to be resized for print. I > might try that route and see what happens. > > @media screen { #content { width:80%; font-size:100%; } } @media print { #content { width:100%; font-size:12pt; } #footer {display:none} } </style> </head> <body> <div id="content"> This will be at 100% of the user's chosen font size for screen. It will print at 12points. This does not require anything except the user hitting the print button on their browser. </div> <div id="footer">This will not print at all.</div> </body> -- Adrienne Boswell at Home Arbpen Web Site Design Services http://www.cavalcade-of-coding.info Please respond to the group so others can share
Other interesting topics
|
|||||||||||||||||||||||