Products

Solutions

Resources

Partners

Community

Blog

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with Use of Browser Back ButtonProblem with Use of Browser Back Button
Previous
 
Next
New Post
5/20/2007 3:54 PM
 
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.

 
New Post
5/21/2007 5:35 AM
 

if you set the Authenticated Cacheability to Public under Host Settings - Performance Settings does it work?

 
New Post
5/21/2007 8:01 AM
 

This is a standard browser message that comes up if you are trying to return to a page that was generated using an HTTP POST versus an HTTP GET. An HTTP POST request is one in which the user submits a form back to the server. This is typical for most pages where you click on a button to submit information. An HTTP GET request is one in which a page is requested from a server using only the URL. The behavior you are seeing is not DotNetNuke specific -- it is a safety measure to ensure that the user does not re-submit a form unintentionally to the server.

When using Response.Redirect, if you don't include the second parameter set to true, the page processing continues even after the Response.Redirect call is encountered. This might be causing problems with the page output. Try using Response.Redirect(DocViewUrl, True).

In general, since DotNetNuke is an extensible environment, you have to be aware that your code does not "own" the page as it would when used in a standalone aspx page. Therefore, you have to write code that takes this into account as it could affect or be affected by other code on the page.

Nik


Nik Kalyani
Co-founder
DotNetNuke Corporation
Blog | Twitter | FaceBook
 
New Post
5/21/2007 2:39 PM
 

Thanks for the quick replies.  Wow, the Response.Redirect(DocViewUrl, True) did not work but setting the Authenticated Cacheability to Public did! It was ServerAndNoCache. I have a weak understanding of many of the nuances of DNN and I am not a guru on ASP.NET yet either so the combination is sometimes a steep climb. Do you guys have an idea why I got this result? I don’t have a clue. Is there some documentation that explains the details of host performance settings?

 

Thanks again,

G.M.

 
New Post
5/22/2007 7:43 AM
 

In Default.aspx DotNetNuke set the Authenticated Cacheability for authenticated user, the default is ServerAndNoCache. For unauthenticated user the ASP.Net default is Privat. So if you login, there is a difference.

The NoCache in HttpCacheability.ServerAndNoCache and HttpCacheability.NoCache disables caching to force the browser to requery the server for the most up to date data or to prevent posting data twice. The back button or history.back() pulls a page from the browser cache, if the page is expired you get the warning.

The behaviour of your Site also depends from the Browser you are using, because they work differently.

Example:

You have a DotNetNuke module with a Gridview and paging enabled.Go to page 1,2,..,n

a) You are not logged in, the HttpCacheability is Privat (ASP.Net default)
 
   click the browser back button and everything works OK (IE7 and Firefox)

b) you are logged in, HttpCacheability is ServerAndNoCache (DotNetNuke default)

   IE7: click the browser back button and you get an expired message.
   FireFox 2.0.0.3: click the browser back button and you don't get an expired message, it works OK

try to set Response.Cache.SetCacheability(HttpCacheability.Privat) on Load of your Control but this can affect other modules on your page.

For your PDF problem try to use a IFrame.

M.H.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem with Use of Browser Back ButtonProblem with Use of Browser Back Button


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out