Link to home
Start Free TrialLog in
Avatar of SamJolly
SamJollyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Best way to reuse ASP.NET code across different sites.....

Hi,

I have trying to find the best way of reusing some self containing visual and non visual functionality from a Web Application in another ASP.NET site.

The bits involed are

a) Login .... into web application using its database
b) Purchase a licence .... and create new user account.... using its DB.

The easy way of doing this would be via IFrames. All one needs to do is create a landing page with the relevant User Control. However IFrames are now popular. Also with the Login component I really need to refresh the parent to the web application on successful login, but this is not possible with FF or Chrome... Cross Site Scripting Protection????

Certainly for the Purchase Licence bit then the IFrame would be fine since the Parent is not touched.

My main browsers will be IE8,IE7, and FF/Chrome going forward. This is a business web system.

What is the best approach to this? Is their an ASP.NET solution? Web Services or what.... ? I really do not wish to do a load of coding on the calling site to create visuals for web service data, just provide a container like the the IFrame does...???

Thanks in advance,

Sam
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SamJolly

ASKER

Thanks . I use User controls all the time and they are site specific. If I could setup a "Remote" user control ie one can access cross site CBH code then I would be happy, but User controls cannot do this.

I just want to be able to provide access to my remote process on the "TargetSite" to the "CallingSite" via a Webpart, Widget or whatever..... The question is how.???? Cetainly the use of an IFrame would do it assuming no Child (IFrame) to Parent script interaction is required (I think they call this Cross Domain Scripting... A security risk apparently....)

Thanks,

Sam
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I was hoping for more of a "inter" site solution like webparts, widgets etct etc rather than a GAccy type solution which would be server dependant.

Thanks for all the help thus far,

Sam
Are you looking to host the controls or do you want to have it running on each server /client?

eg:

client -> Iframe -> your server somewhere

or

client -> server with your code
Hi Ged,

Basically I was hoping for the "server" to have the control and manage the operation of the process. The "client" would just provide a "window" onto this. The Iframe is the simplest conceptual way of doing this and explains what I am after nicely. However there is no way for the result to affect the "client" page due to security restrictions which one may want to do from time to time ie Successful login via a remote "Server" login control redirect parent's "client" page to "server" application page. I believe one can do this with HTML5 via a specific "DoMessage" method, but it is too early yet.

Also such an IFrame type mechanism lets all the "server" CBH stuff work as is with out extra coding. Since I control both the "server" and "client" part I would have thought that I could pass some form of "trust" token between the two to enable the "child" to interact with the "parent" page. But no can do it seems....???

Cheers,

Sam
An Iframe is a window on the client that opens up to another page . . . which can be served by the same server that the original page (which contains the iframe) came from or to another server.

The security model should be handled on the server before the page is rendered.  If you don't want to allow for editing, disable all of the controls so that they are read only.  

Not exactly sure what you mean by redirecting the parents client page to the server application.  A parent implies there is a child somewhere.  

It would be helpful if you had a more concrete example.
Hi Ged,

OK..

ClientHome.aspx (Parent)
    contains IFrame id=Login src="http://Server/Login.aspx. (Child)

Server/Login.asp uses Login.ascx which then redirects to LoginSuccess.aspx when successful via LoginView's attribute "destinationURL". I am using the Membership Provider. In the LoginSuccess.aspx page I have "<body onload="javascript:parent.test();">".  In the function "test()" within the Parent is the instruction of where to redirect to. This seems to work in IE7, but not in FF or Chrome due to Cross Domain Scripting retrictions. Shame.... since I have control of both ends.

Thanks for any help that you can provide,

Sam

what if you did this with a

response.redirect(url)

instead of a javascript?

Thx all. Apologies for the delay. I am closing this now.


Thx all.