Avatar of SamJolly
SamJolly
Flag 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
.NET ProgrammingWeb ApplicationsASP.NET

Avatar of undefined
Last Comment
SamJolly

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kyle Abrahams

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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
Kumaraswamy R

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SamJolly

ASKER
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
Kyle Abrahams

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
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SamJolly

ASKER
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
Kyle Abrahams

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.
SamJolly

ASKER
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

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Kyle Abrahams

what if you did this with a

response.redirect(url)

instead of a javascript?

SamJolly

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


SamJolly

ASKER
Thx all.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck