Hi,
I have a problem with a user control that I use to display images and documents.
I use this to get to the user control:
Response.Redirect(Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ViewDoc", "mid=" & CStr(lModuleId) & "&BDataId=" & BDataId & "&MbrId=" & MbrId))
The code behind/beside logic displays the document or image OK using the Ids passed in the query string. It’s getting back to the original page that is a problem. If I am not viewing things in administrator mode or actually logged in to the site at all I can click the IE browser back button and everything works OK. When I log in however and view a document or image I get this error when I click the back button although I do get the page back when I click it again.
Warning: Page has Expired
The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button.
Any suggestions on how to get around this?
Thanks,
G. M.
I discovered another problem. I was able to display documents like Word but for some reason not PDFs. I went to this:
Response.Redirect(DocViewUrl)
where DocViewUrl is a string representing a URL for a web form (aspx file) not a user control. Now I can display any doc type. Somehow the DNN framework has a problem with a user control trying to display a PDF. However, I still have the Back Button problem when I am logged in but not when I am just viewing as an anonymous user. BTW here is the code I am using to display various documents that I read from an SQL Server database table column defined as varbinary(max).
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim BDataId As Integer = Convert.ToInt32(Request.QueryString("BDataId"))
Dim MbrId As Integer = Convert.ToInt32(Request.QueryString("MbrId"))
' Get the binary data for the image or document from the database via
' via a data provider method (DocsImageSelect)
Dim objSSCITableModCtl As New SSCITableModController
Dim SqlDataDoc As SqlDataReader = objSSCITableModCtl.DocsImageSelect(BDataId, MbrId)
If SqlDataDoc.Read() Then
Response.ContentType = SqlDataDoc.GetString(3)
Response.BinaryWrite(SqlDataDoc.GetSqlBinary(4))
End If
End Sub
This code actually worked in a user control also for everything except a PDF.
With the web form all of this seems to work except the Back Button. Any help with some sort of workaround or possibly some other approach would be most appreciated.
Thanks,
G.M.