Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help with links to files ...Help with links to files ...
Previous
 
Next
New Post
11/26/2008 2:51 PM
 

I have some protected files on my site, and the links to the files are available to everyone.

If someone clicks a link and they are not logged in, the get a message that says "You do not have permission ..."

I would like to make this a bit friendlier.  If they click that protected link, instead of the message I would like for them to be redirected to the login page.

Any ideas how to do this? 




Joe Craig
Patapsco Research Group, Ellicott City, MD
DotNetNuke Development and Services (http://patapscorg.com)
 
New Post
12/1/2008 12:51 PM
 

Hey Joe,

The message that is displayed is just plain text rendered in the browser. If you view source, you see only the message (You Do Not Have Permission To View The Requested File).

A quick hack would be to localize the value of that message with some HTML to redirect you to another page. The localization property is found in:

App_GlobalResources\SharedResources.resx -> "FilePermission.Error

You could use a meta-refresh to redirect the user to your login page. In general the downside of a meta refresh is that it is not a 301 redirect, and isn't as search engine friendly. In this case, I doubt that matters much.

Here is some HTML that you could localize that with to perform that action:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <title>My Temporary Page</title>

    <meta http-equiv="REFRESH" content="0;url=http://www.the-login-page-url.com" />

</head>

<body>

    <p>You could update the refresh to 10 from 0 and tell the user that they must be logged in and that you're redirecting them now...and maybe provide a link too.</p>

</body>

</html>

Hope that helps,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
New Post
12/3/2008 1:20 AM
 

 
Adding to Ian's suggestion...
 
RETURNURL
If you decide to modify your resource file to provide a URL to your LOGIN page, AND if your portal provides document links only on a certain page, you could append the RETURNURL querystring value to have your visitors auto-redirected back to the documents module page once they log in.

To use RETURNURL querystring option, add the following to the end of your login page URL:

   ?returnurl=%2ftabid%2f(your document module page's tabid value here)%2fDefault.aspx


Also:  Portal-Specific Resource Files
Make a copy of your resource file and rename the copy as a portal-specific file.  Such files reside in the same directory as the original resx but follow a very specific naming convention:  instead of ending with ".resx", a portal-specific version will end with "Portal-x.resx" with "x" being your portal number.  I'm not sure if this applies to resx files under App_GlobalResources but it certainly works most everywhere else.

Example:
If your resource file is "Profile.ascx.resx" and your portal number is "2", a portal-specific version of the resource file would be named "Profile.ascx.Portal-2.resx".   The default resx is loaded followed by the portal-specific resx (if any).  Because of this, your portal-specific resx only needs to include references for values you wish to override.

By creating and using a portal-specific resx you'll only affect resource values for your portal rather than for your entire DNN instance, which could be a very good thing in the case of changing "You do not have permission" to a meta refresh to a specific login URL.
 

Cheers!
-mamlin 


esmamlin atxgeek.me
 
New Post
12/4/2008 11:26 AM
 

Joe & mamlin,

Great minds must think alike! Here is my overdue blog post that elaborates on my original suggestion. Would have had it out sooner but I was fighting the syntax highlighter plugin -> Improving the Secured File Download UX for Unauthenticated Users.

Take care,

Ian


Software Engineer
Co-Founder, dnnGallery
Stack Overflow: Ian Robinson
Twitter: @irobinson
Linked In: Ian Robinson
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help with links to files ...Help with links to files ...


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