function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kevin LanguedocKevin Languedoc 

VF & asp.net

I have an asp.net page that contains a report with from an external database. The asp.net page has to be embedded into the VF page so the users can remain in the same page. How can I pass the current sf session id and sf server url require to authenticate to the asp.net page because the asp.net page needs account information form salesforce.com.

 

thx

 

kevin

aalbertaalbert

Here is some code I have used to get the API Server URL and Session ID in a Visualforce Page and passing it to the Apex Controller:

 

 

<apex:page setup="true" controller="MyController" showHeader="false">

<apex:form >

<apex:outputpanel id="counter">

<apex:outputText value="Click Here To Login" />

<apex:actionSupport event="onclick" action="{!doLogin}" rerender="refreshId" status="counterStatus">

<apex:param name="sessionId" assignTo="{!apiSessionId}" value="{!$Api.Session_ID}" />

<apex:param name="serverURL" assignTo="{!apiServerURL}" value="{!$Api.Partner_Server_URL_140}" />

</apex:actionSupport>

</apex:outputpanel>

<br></br>

<apex:outputPanel id="refreshId">

<apex:outputText value="API Session Id: {!apiSessionId}"/><br></br>

<apex:outputText value="API Server URL: {!apiServerURL}"/><br></br>

</apex:outputPanel>

</apex:form>

</apex:page>

 And here is a snippet of the controller:

 

public class MyController { public String apiSessionId {get;set;} public String apiServerURL {get;set;} public PageReference doLogin(){ System.debug('apiSessionId: ' + apiSessionId); System.debug('apiServerURL: ' + apiServerURL); return null; } }

 

 

 

 

 

Kevin LanguedocKevin Languedoc

Thanks for the information, it works great

 

kevin

Kevin LanguedocKevin Languedoc

I also tried this technique with success.

 

 

  <apex:pageblock >   
           

                <iframe src="http://localhost:2230/SomeApp/App.aspx?accname={!AccountNumber}&sessionId={!$@Api.Session_ID}&serverURL={!@$Api.Partner_Server_URL_140}" frameborder="0" width="100%" height="700"/>
            

</apex:pageblock> 

 

Kevin LanguedocKevin Languedoc

please ignore my previous post, the sf server assumed that the content was a live link

 

 

 

 <apex:pageblock >   
             <iframe src="http://localhost:2230/AppFolder/ASPApp.aspx?accname={!AccountNumber}&sessionId={!@$Api.Session_ID}&serverURL={!@$Api.Partner_Server_URL_140}"  frameborder="0" width="100%" height="700"/>
            

 </apex:pageblock>