Greg Gum
Greg Gum

Reputation: 37875

IFrame in an ASP.net app

I have an ASP.net website (a DNN app). User can log in using the usual-login.

Now I need to create an application that is completely separate from the existing website, yet it needs to appear as part of the existing website. The proposed solution right now to this is using an IFrame.

The problem with this however, is that the app needs to have a security context - in other words, know who is logged in and what role they are assigned.

Is this possible in an IFrame? From what I have found so far, the IFrame is "dumb" ie restricted from the rest of the webpage. If this is the case, is there an alternative to using an IFrame?

Greg

Upvotes: 0

Views: 341

Answers (1)

Vijay Singh
Vijay Singh

Reputation: 317

Try this

create two public local variables in DNN code behind Page Where You want implement iframe like

 public string loginuser;
 public string Role;

set current logging user details in this two variables like username and role and if not any user logging then its value blank

in aspx page where iframe exists

<iframe src="http://App.MainSite.com?currentuser=<%= loginuser%>&role=<%= Role%>"></iframe>

Read query string values on your App.MainSite.com page load event

if (Request.QueryString["currentuser"!=null && Request.QueryString["currentuser"!="") {
    //Current User
}

if (Request.QueryString["role"!=null && Request.QueryString["role"!="") {
    //Current User role
}

Upvotes: 1

Related Questions