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 ...Add a custom handler to web.configAdd a custom handler to web.config
Previous
 
Next
New Post
5/15/2011 8:04 AM
 
I have written a custom handler that I want to be called after a successful login. It checks the status of the logged in user's email address against a database table and redirects the user to a Classic ASP site they are authorized to view (with a few fallbacks to handle scenarios like no websites allowed or multiple sites allowed).

I want this code to be called in two situations - after successful login and when the user clicks a button to say 'return me to my site'. All other DNN requests should ignore the handler.

I have tried creating a registered users only blank page called RedirectToClassicASP which is accessed using RedirectToClassicASP.aspx. I then added my handler registration alongside the other handlers in web.config:

<add name="ClassicAspAuthenticationHandler" verb="*" path="RedirectToClassicASP.aspx" type="ClassicAspAuthenticationHandler, ClassicAspClientRedirection.Logic" preCondition="integratedMode" />

I was expecting to see this handler invoked when accessing the ~/RedirectToClassicASP.aspx page but it isn't. I get ~/Default.aspx?tabid=377&language=en-US instead and see the blank page. If I change the registration to use Default.aspx instead of RedirectToClassicASP.aspx the handler is called.

Note that this handler also works most of the time if I register it to handle Default.aspx and then include code to jump around the redirection when not needed. Here is the code that has been working for 6 months on our production site:

public void ProcessRequest(HttpContext context)
{
//todo make this use the portalid?
if (context.Request.RawUrl.Contains(@"RedirectToClassicASP"))
{
var redirection = new Redirection();
redirection.Redirect();
} // no redirection so carry on as normal
var handler = PageParser.GetCompiledPageInstance(context.Request.CurrentExecutionFilePath, null, context);
handler.ProcessRequest(context);
}

Unfortunately, some of my applications fail in the handler.ProcessRequest(context) statement. I am not sure why, but until I find out, I am hoping to make handler called only when it is needed.

Where am I going wrong? Is there a better way to achieve this redirection?
 
New Post
5/15/2011 10:04 AM
 
On further experimentation, I have got it to work. I did it by changing the handler's Path to Back.aspx. I have no idea if this fixed it or if I managed to config something else properly in the meantime.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Add a custom handler to web.configAdd a custom handler to web.config


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