0

I write a standalone aspx file and upload it to DNN website. I add a html module and make an iframe to that aspx file. How I should check DNN user login or not in aspx file? I think there are something in Session but it is empty when I print it out on aspx page.

complez
  • 7,882
  • 11
  • 48
  • 56

2 Answers2

2

The aspx file executes outside of DNN. There is no context for you to work with. A much better approach is to turn your .aspx into a .ascx and derive from PortalModuleBase as the start of a DNN module. You can add a proper module to the page and permission the module as you see fit and DNN will take care of all the authentication and authorization details for you.

A starting point for module development

I don't recommend it in this situation, but you can also emulate the approach I described for getting context in a web service.

https://stackoverflow.com/a/9164573/51851

Community
  • 1
  • 1
ScottS
  • 8,455
  • 3
  • 30
  • 50
0

If your aspx is within DNN's website you can simply use Request.IsAuthenticated to check if user is logged in or not.

But be warned, if you have friendly URL turned on - DNN 5x and above will hijack you aspx request.

Ashish
  • 1,171
  • 11
  • 12