Popping up a dialog box on client side for authentication in a proxy server

hi all,
we have wriiten a code for proxy server.now we want to add the authentication code in the same which will authenticate client by popping up a dialog box on the client side.though no code runs on the client side.only the client has to open the browser and enter the credentials.
we dont know how to pop up this authentication window on the client side when he requsts for the service.
Its almost like a SQUID where the pop up box appears.
The code for our proxy server is
import java.net.*;
import java.io.*;
public class BasicProxyServer {
     private static int serverPort;
     private static String primaryServerHost;
     private static int primaryServerPort;
     // 1st arg: port to listen on     // 2nd arg: primary server IP     // 3rd arg: primary server port
     public static void main(String [] args) {
          serverPort = Integer.parseInt(args[0]);
          primaryServerHost = args[1];
          primaryServerPort = Integer.parseInt(args[2]);
          BasicServer bserv = new BasicServer(serverPort,primaryServerHost,primaryServerPort);
class BasicServer extends Thread {
     private int serverPort;
     private String primaryHost;
     private int primaryPort;
     private ServerSocket servSock = null;
     public BasicServer(int port, String primSrv, int primPort) {
          serverPort = port;
          primaryHost = primSrv;
          primaryPort = primPort;
          start();
     public void run() {
          Socket clientSock = null;
          Socket primaryServerSock = null;
          try {
               servSock = new ServerSocket(serverPort);
          catch (IOException e) {
               e.printStackTrace();
          while(true) {
               try {
                    clientSock = servSock.accept();
                    primaryServerSock = new Socket(primaryHost, primaryPort);
                    PipedInputStream fromClient = new PipedInputStream();
//BufferedReader br= new BufferedReader(new InputStreamReader(clientSock.getInputStream()));
//String ipline=br.readLine();
//History hi=new History();
//hi.writeHistory(ipline);
//try{
//hi.getHistory();
//catch(ClassNotFoundException cne){
// System.out.println(cne);
                    PipedOutputStream toMainServer = new PipedOutputStream(fromClient);
                    PipedInputStream fromMainServer = new PipedInputStream();
                    PipedOutputStream toClient = new PipedOutputStream(fromMainServer);
                    Talk clientToMainServer = new Talk(clientSock, fromClient, primaryServerSock, toMainServer);
                    Talk mainServerToClient = new Talk(primaryServerSock, fromMainServer, clientSock, toClient);
                    clientToMainServer.start();
                    mainServerToClient.start();
               catch (IOException e) {
                    e.printStackTrace();
protected void finalize() {
if (servSock != null) {
try {
servSock.close();
} catch (IOException e) {
e.printStackTrace();
servSock = null;
class Talk extends Thread {
     private Socket incoming;
     private Socket outgoing;
     private InputStream in;
     private OutputStream out;
String urlrequest="";
     private InputStream from;
     private OutputStream to;
     Talk(Socket inSock, InputStream in, Socket outSock, OutputStream out) {
          this.in = in;
          this.out = out;
          incoming = inSock;
          outgoing = outSock;
     public void run() {
          int aByte;
          try {
               from = incoming.getInputStream();
               to = outgoing.getOutputStream();          
               while(( aByte = from.read()) != -1 ) {     //read from socket
                    out.write(aByte);
if(new Integer("3128").equals(incoming.getPort()))
urlrequest=urlrequest+out.toString();
urlrequest=urlrequest+incoming.getPort()+outgoing.getPort();
// write to pipe`
                    // read the byte from the pipe
                    to.write(in.read());          // write it to the output socket stream
                    to.flush();
System.out.println(urlrequest);
               to.close();
               from.close();
               if(incoming != null) {
                    incoming.close();
                    incoming = null;
               if(outgoing != null) {
                    outgoing.close();
                    outgoing = null;
          catch (SocketException e) {
          // there is one for a closed socket. Seems to have no effect.
          //     e.printStackTrace();
          catch (IOException e) {
               e.printStackTrace();
waiting for reply.....

Install a java.net.Authenticator.

Similar Messages

  • I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content)

    I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content) is there a fix to this problem? using 8.1, Monitor is a high res.2560x1440.

    Another View.
    the GUI is so hard to read (so small) I enlarge my Ps UI by the instructions below...which helped a lot.

  • Displaying selection screen as pop-up from dialog box

    Hi,
          I have a screen which is of dialog-box type. This dialog screen shows an ALV and has a button in the ALV toolbar. On pressing this button, a pop-up screen is to be displayed. This pop-up screen is designed as a selection-screen. Is it possible to display this selection screen as a pop-up from a dialog box screen?
    Regards,
    Suhas

    Hi Suhas,
    Its possible to display selection screen as pop-up from dialog box.....Check the code below...copy paste and execute...
    SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE text-001.
    PARAMETER p.
    SELECTION-SCREEN END   OF SCREEN 123.
    CALL SELECTION-SCREEN 123 STARTING AT 20 5
                                ENDING AT 80 15.
    The below code might help u to add a button in alvgrid's toolbar......
    *       CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        DATA: wa_toolbar   TYPE stb_button,
              calc         TYPE REF   TO cl_gui_frontend_services.
        METHODS : toolbar_handle FOR EVENT toolbar      OF cl_gui_alv_grid
                                        IMPORTING e_object
                                                  e_interactive,
                  ucomm_handle   FOR EVENT user_command OF cl_gui_alv_grid
                                        IMPORTING e_ucomm.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD toolbar_handle.
        MOVE   3 TO  wa_toolbar-butn_type.
        APPEND wa_toolbar   TO e_object->mt_toolbar.
        MOVE : 0            TO wa_toolbar-butn_type,
               'CALC'       TO wa_toolbar-function,
               '@0M@'       TO wa_toolbar-icon,
               'Calculator' TO wa_toolbar-quickinfo.
        APPEND wa_toolbar TO e_object->mt_toolbar.
      ENDMETHOD. "toolbar_handle
      METHOD ucomm_handle.
        IF e_ucomm = 'CALC'.   " When button added in toolbar is clicked
          IF calc IS INITIAL.
            CREATE OBJECT calc.
          ENDIF.
          CALL METHOD cl_gui_frontend_services=>execute
       EXPORTING
         application            = 'CALC'.
        ENDIF.
      ENDMETHOD. "ucomm_handle
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    DATA : container    TYPE REF   TO cl_gui_custom_container,
           grid         TYPE REF   TO cl_gui_alv_grid,
           event        TYPE REF   TO lcl_event_handler,
           it_display   TYPE TABLE OF mara,
           wa_display   TYPE mara.
    START-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM build_it_display.
      PERFORM create_objects.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'EXIT'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'CANC'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  build_it_display
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_it_display .
      SELECT * FROM mara UP TO 15 ROWS INTO TABLE it_display.
    ENDFORM.                    " build_it_display
    *&      Form  create_objects
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_objects .
      IF container IS INITIAL.
        CREATE OBJECT container
        EXPORTING
          container_name     = 'CUSTOM'.
        CREATE OBJECT event.
        CREATE OBJECT grid
          EXPORTING
            i_parent         = container.
        SET HANDLER event->toolbar_handle FOR grid.
        SET HANDLER event->ucomm_handle   FOR grid.
        CALL METHOD grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'MARA'
          CHANGING
            it_outtab        = it_display.
      ENDIF.
    ENDFORM.                    " create_objects
    Cheers,
    Jose.

  • How can I avoid the Local storage pop-up question dialog box during playing you tube vedios ?

    How can I avoid the Local storage pop-up question dialog box during playing you tube vedios ?

    You might try tweaking your global privacy settings.  I suspect it's set to "always ask."
      Go to this page -- http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.htm l -- which contains the settings panel for Flash Player, and click on the various "deny" buttons to disable this.  (It's a good idea to click on all the tabs to check the settings.)
    If this works for you, please post back.  (I know it worked for me.)
    Ortho_Fan
    (not a techie)

  • ITunes keeps popping up a dialog box that says "An update to the carrier settings for your iPhone is available. Would you like to download it?" What is this?

    iTunes keeps popping up a dialog box that says "An update to the carrier settings for your iPhone is available. Would you like to download it?" What is this? When I click on the "Learn More" button in the dialog box it takes me to a generic iTunes support page that has no relevance to carrier settings.

    I got this three times within the last 4 hours and have been getting it almost every day since I use my new iPhone 6 - over a week now. This happens almost every time I connect the phone to my MacBook Pro, although every time I confirm and it indicates successful update.
    It is highly unlikely that my carrier updates settings on daily basis or three times a day. It is almost surely a bug in the Apple system and anything but a timely and effective solution is unacceptable.
    For debugging information, I recovered a backup from my former iPhone 5 onto the new one, using the same carrier and SIM.

  • Is there a LabVIEW function that will pop-up a dialog box to prompt the user if he is sure he wants to do when a boolean switch is pressed?

    I want to prompt the user by asking, "Are you sure you want to do this?" when the user presses a switch.  If the user clicks "Yes" then the switch changes state, if the user clicks "No" then the switch retains the current state.  Does such a thing exist or do I have to invent it?  I am new to LabVIEW.
    Thanks.

    You can use an event structures filter event on mouse down for something like this.  Pop up a dialog and invert the logic for the output and sent it to the Discard? modifier on the right side.  See example for assistance.
    Attachments:
    Untitled 1.vi ‏24 KB

  • Never recvd verification code, in PHOTOMAIL dialog box it is asking for one when trying to email pictures,never saw any codes when setting this up

    verification code, never received it when setting up contacts to email pictures, in PHOTOMAIL dialog box it is asking for one to verify my email address and said it was sent to my email, went back and checked and there wasn't anything there, where is it or what do I need to do now????

    Does the account you are using have admin rights? I found this :
    http://support.apple.com/kb/HT2397
    +In Mac OS X 10.3 Panther and later, users with administrative privileges aren't prompted to change the region the very first time a DVD-Video disc of a single region is inserted. Instead, the region of the DVD drive is automatically set to the region of the DVD disc that was inserted. Accounts that don't have administrative privileges must authenticate with an administrator account name and password, because changing the drive's region code requires administrative privileges.+
    Sounds like it might be worth a try from an admin account first.

  • DI-Proxy Client side(4.2.0) and Proxy Side (4.1.2)

    Hi all,
    I am getting following error when i was try test connection In B1if SAP B1 Database "DI-Proxy Client side(4.2.0) and Proxy Side (4.1.2)" . Here Sap B1 One server database diffrerent server. DI proxy Installed on Database server.  Please advice me how to solver
    Thanks & regards
    B.Lakshmi narayanan

    Integration framework upgrade again. it's solved

  • Unable to create SASL client connection for authentication mechanism [PLAIN

    I have problem to use dscc to admin my ds/dps servers, since I the dscc can't contact dscc agent. Though the agent is running on the default port number with network-bind-port of 0.0.0.0, there is nothing I can do to fix it.
    I debug the problem, and found following errors in server.log under dscc (deployed on SUN AS 8.2):
    Message: Unable to create SASL client connection for authentication mechanism [PLAIN]|#]
    [#|2007-08-21T15:28:40.252-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.jmx.remote.opt.security.SASLClientHandler.initialize(SASLClientHandler.java:124)|#]
    [#|2007-08-21T15:28:40.253-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.jmx.remote.opt.security.AdminClient.connectionOpen(AdminClient.java:131)|#]
    [#|2007-08-21T15:28:40.254-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.jmx.remote.generic.ClientSynchroMessageConnectionImpl.connect(ClientSynchroMessageConnectionImpl.java:71)|#]
    [#|2007-08-21T15:28:40.256-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | javax.management.remote.generic.GenericConnector.connect(GenericConnector.java:177)|#]
    [#|2007-08-21T15:28:40.257-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | javax.management.remote.jmxmp.JMXMPConnector.connect(JMXMPConnector.java:119)|#]
    [#|2007-08-21T15:28:40.258-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)|#]
    [#|2007-08-21T15:28:40.260-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.directory.nquickclient.NquickClient.getJmxConnector(NquickClient.java:816)|#]
    [#|2007-08-21T15:28:40.261-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.directory.nquickclient.NquickClient.getConnector(NquickClient.java:519)|#]
    [#|2007-08-21T15:28:40.262-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.directory.nquickclient.NquickClient.getConnectorSystemAuthentication(NquickClient.java:314)|#]
    [#|2007-08-21T15:28:40.263-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.directory.dcc.core.NquickPool.getSyncServerMBean(NquickPool.java:435)|#]
    [#|2007-08-21T15:28:40.264-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | com.sun.directory.dcc.core.NquickPool$1.run(NquickPool.java:320)|#]
    [#|2007-08-21T15:28:40.271-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.admin.directory.dcc.util.ViewBeanUtils:appendDebugLine | java.lang.Thread.run(Thread.java:534)|#]
    [#|2007-08-21T15:28:40.289-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.ui.taglib.pagetitle.CCPageTitleTag:appendPageTitleAlertAndText | Node has no attributes.|#]
    [#|2007-08-21T15:28:40.293-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.ui.taglib.pagetitle.CCPageTitleTag:appendPageActions | Could not obtain pageactions element.|#]
    [#|2007-08-21T15:28:40.295-0400|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=11;|
    15:28:40 | httpWorkerThread-8080-0 | com.sun.web.ui.taglib.pagetitle.CCPageTitleTag:appendPageViewsMenu | Could not obtain pageviews element.|#]
    Please help if you could figure out what's going on. Thanks!

    Bug ID: 6551672
    Synopsis: SunAS claims "Unable to create SASL client conn for auth mechanism" and do not talk to Cacao
    Work Around:
    Work arround:
    Change the JVM of used by App Server.
    Edit the file:
         /usr/appserver/config/asenv.conf
    and replace
         AS_JAVA="/usr/j2se"
    by
         AS_JAVA="/usr/java"
    Then restart your AS domain.

  • Open dialog box window with checkboxes for each child record - Please Help

    Hello Everybody
    I have a 10g form with master record and 20 child records. In the child record form, currently there is a “Notes” Editor, which pops up when user click the “Edit” button. In the “Notes” editor, user enters remarks if anything is missing. For example, typical remarks will be: Statement is missing, LOC paper is missing etc.
    Now, I would like to replace “Notes” editor with a dialog box. In the dialog box , I would like to add checkboxes with values “Statement is missing” and “LOC paper is missing” etc. along with “Notes” field. The user can select checkboxes. The value of the checkboxes should go in the “Notes” field with the ability to edit it. This way, user doesn’t need to type the most common notes every time.
    I have created a “NewNotes” dialog box with checkboxes and multiline text Item. It is pops up when I click on the button. I have also created to WHEN_CHECKBOC_CHANGED trigger for each checkboxes so that the its value will go in a multiline text item.
    But, I am not sure how I can link “NewNotes” dialog box to the each record in child record block. I would really appreciate it if anybody could give me some idea.
    Thanks,

    if i understand correctly you have a note item (based on table) on every child record? when you open the dialog box: how do you put data from notes to dialog box? in the same way as you can write it back ...

  • No Dialog Box at "Connect As" for Server

    I have not seen this issue mentioned elsewhere, so I thought I'd post. I will update with specifics when I get to the office. Here's the little I know:
    The user's client, a late-model MacBook running Yosemite, connects to the network and can see the server, a recent-ish Mac Mini running Server 3/Mavs, listed in the Finder window. When you click the item, it reads "Connection Failed". When you click "Connect As", the status changes to "Not Connected". But there's no dialog box asking for user and password. Individual client machines in the network also appear in the Finder window, and those connections behave normally.
    This is the only client machine with this behavior; another similar machine also running Yosemite connects without issues. I believe this is the first time problematic client machine attempted to connect to the server, while the one that works normally had connected many times previously before and after its upgrade to Yosemite.
    Thanks in advance for any ideas. I will update with specific versions in a couple of hours.

    DISREGARD: User was able to connect this device with no issues as of this morning.

  • Open Dialog box: disable image preview (For large images, it's SLOOOWWWW)

    Open Dialog box in column view:
    Can I disable image preview?
    For large images, it's SLOOOWWWW !!!!!
    ( I often work with 8000 x 3500 panoramic images )

    William
    Mostly this is a problem in PhotoshopOK, my Photoshop is still a Classic version. I was looking at one or two others, like GraphicConverter, but the only pref there seems to be to generate a Preview if one doesn't exist.
    I'll look some more—it's irritating me now

  • What permissions are needed on the client side for RunspaceFactory.CreateRunspace?

    Hi.
    I am running a remote powershell command from an IIS application to an Exchange server getting the below error. Everything works fine if the IIS application pool identity is in the local administrators group on the IIS server so we can rule out issues with
    firewall or anything on the Exchange server. It is a problem with lack of privileges on the local server. 
    So my question is: What permissions are required on the local server for RunspaceFactory.CreateRunspace? I find good documentation on the permissions required on the server side, but nothing about the client side.
    The last Win32 error code after failure is 1008.
    An internal error occurred. 
    at at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.Initialize(Uri connectionUri, WSManConnectionInfo connectionInfo) 
    at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager..ctor(Guid runspacePoolInstanceId, WSManConnectionInfo connectionInfo, PSRemotingCryptoHelper cryptoHelper) 
    at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl..ctor(ClientRemoteSession session, PSRemotingCryptoHelper cryptoHelper, RunspaceConnectionInfo connectionInfo, URIDirectionReported uriRedirectionHandler) 
    at System.Management.Automation.Remoting.ClientRemoteSessionImpl..ctor(RemoteRunspacePoolInternal rsPool, URIDirectionReported uriRedirectionHandler) 
    at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler..ctor(RemoteRunspacePoolInternal clientRunspacePool, TypeTable typeTable) 
    at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable typeTable, PSHost host, PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo) 
    at System.Management.Automation.Runspaces.RunspacePool..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable typeTable, PSHost host, PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo) 
    at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspacePool(Int32 minRunspaces, Int32 maxRunspaces, RunspaceConnectionInfo connectionInfo, PSHost host, TypeTable typeTable, PSPrimitiveDictionary applicationArguments) 
    at System.Management.Automation.RemoteRunspace..ctor(TypeTable typeTable, RunspaceConnectionInfo connectionInfo, PSHost host, PSPrimitiveDictionary applicationArguments) 
    at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(RunspaceConnectionInfo connectionInfo, PSHost host, TypeTable typeTable, PSPrimitiveDictionary applicationArguments) 
    at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(RunspaceConnectionInfo connectionInfo) 

    Thanks Daniel.
    I see that the IIS server has a GPO setting 'Allow log on locally' to the local administrators group for this server. I will order add of the IIS app pool identity to this list.
    I tried the process monitor comparing runs with and without the app pool identity as local administrator. The runs are identical up to the point where one does something useful and the other closes 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN'.
    There are no failures.
    I am not using my runspace objects for multiple threads. I dispose after use.
    I will end up with the below if I change. Comments?
    public static PowershellResult RunPowerShellCommandExchange2010(string exchangeServer, string command, ICollection<KeyValuePair<string, object>> parameters, string usr, string pwd) {
    WindowsImpersonationContext impersonationContext = null;
    try {
    impersonationContext = WindowsIdentity.Impersonate(IntPtr.Zero);
    GetProcessInformation();
    try {
    var connectionInfo = GetExchange2010ConnectionInfo(exchangeServer, usr, pwd);
    using (var runspace = RunspaceFactory.CreateRunspacePool(1, 1, connectionInfo)) {
    using (PowerShell powershell = PowerShell.Create()) {
    var psCommand = new PSCommand();
    if (parameters != null) {
    psCommand.AddCommand(command);
    foreach (KeyValuePair<string, object> parameter in parameters) {
    if (parameter.Value == null) psCommand.AddParameter(parameter.Key);
    else psCommand.AddParameter(parameter.Key, parameter.Value);
    } else {
    //if parameters argument is null the command will be treated as script
    psCommand.AddCommand(new Command(command, true));
    powershell.Commands = psCommand;
    runspace.Open();
    powershell.RunspacePool = runspace;
    var resultPSObjects = powershell.Invoke();
    var psResult = new PowershellResult {
    PSObjects = resultPSObjects,
    Errors = powershell.Streams.Error.ToList()
    return psResult;
    } catch (Exception ex) {
    var windowsIdentity = WindowsIdentity.GetCurrent();
    int errorCode = Marshal.GetLastWin32Error();
    if (windowsIdentity != null) throw new Exception(string.Format("Failed to run Exchange powershell command '{0}' as user {1} passing executing user {2} due to: {3} at {4}. Server: {5}. Last error code: {6}", command, windowsIdentity.Name, usr, ex.Message, ex.StackTrace, exchangeServer, errorCode), ex);
    throw new Exception(string.Format("Failed to run Exchange powershell command '{0}' as unknown user passing executing user {1} due to: {2} at {3}. Server: {4}. Last error code: {5}", command, usr, ex.Message, ex.StackTrace, exchangeServer, errorCode), ex);
    } finally {
    if (impersonationContext != null) {
    impersonationContext.Undo();
    Tore Olav Kristiansen

  • Grey patches are found while moving pop-up print dialog box

    Hi,
    Please help me with this one.
    I am trying to print in a Windows environment,
    I call printJob.printDialog() from my program to get the pop window. But if i move this box with my mouse, it always leaves behind grey patches on my swing application that I developed.
    I just don't know what to do.
    Any pointers ?

    in response to the user selecting "print", do:   Thread pThread = new PrintingThread(instance);   //where instance is a reference to the gui frame
        pThread.start();...and define this class:   class PrintingThread extends Thread {
            JFrame gui;
            PrintingThread(JFrame g)
                gui=g;
                //do any initialization you need here
            public void run()
                gui.setEnabled(false);
                // call printJob.printDialog() here
                //then when it returns do:
                gui.setEnabled(true);

  • Error while trying to validate two input boxes at client side.

    This is the code i am using to validate two input boxes.
    I get an error in the IE which says: <b>'undefined is null or not an object'</b>
           function validateInput(){
                var noNull = validateNull();
                var noNullTwo = validateNullTwo();
                if(noNull==true)
                else
                     alert("Enter values");
                     htmlbevent.cancelSubmit="true";
         function validateNull(){
              var startRange;
              funcName = htmlb_formid + "_getHtmlbElementId";
              func = window[funcName];
              var temp1 = eval(func("range_Start"));
              startRange = temp1.getValue();
              if(startRange == '')
                   return false;
              else
                  if(startRange.length < 8)
                     alert("Enter the value in proper format");
                     htmlbevent.cancelSubmit="true";
                  else
                      return true;
         function validateNullTwo(){
              var endRange;
              funcName2 = htmlb_formid + "_getHtmlbElementId";
              func2 = window[funcName2];
              var temp2 = eval(func("range_End"));
              endRange = temp2.getValue();
              if(startRange == '')
                   return false;
              else
                  if(endRange.length < 8)
                     alert("Enter the value in proper format");
                     htmlbevent.cancelSubmit="true";
                  else
                      return true;
         </script>
       <hbj:form id="myFormId" >
         <hbj:textView id="title" text="Enter Sales Order Search Range" design="HEADER2"/><br><br>
         <hbj:label id="lb_SearchStart" text="Start Range:" labelFor="range_Start" />
         <hbj:inputField id="range_Start" jsObjectNeeded="true" type="string" required="true" maxlength="25"/>
         <hbj:label id="lb_SearchEnd" text="End Range:" labelFor="range_End" />
         <hbj:inputField id="range_End" type="string" maxlength="25"/><br><br>
         <hbj:button id="submit" text="Search!" tooltip="Click me to Search" onClientClick="validateInput()" onClick="searchPressed" design="emphasized" />
       </hbj:form>
      </hbj:page>

    Hi Portal Newbie,
       Please follow the below code. One i/p filed ,a button and a Java Script function.
        In the function i searched with only null, if you want you can perform another function.
       If you have any issues, please write me back.
      <hbj:inputField
            id="SystemId"
         disabled="false"
         type="string"
         maxlength="60"
         value=""
         jsObjectNeeded="true" />
      <hbj:button
            id="Search"
           text="Update"
           width="125px"
            tooltip=""
            onClick="UpdateSystem"
            onClientClick="validateFields()"
            disabled="false"
            design="EMPHASIZED"/>
    <script language= "JavaScript" >
         function validateFields(){
           var funcName=htmlb_formid+"_getHtmlbElementId";
           func=window[funcName];
           var inputfield=eval(func("SystemId"));
           var value=inputfield.getValue();
           if(value=="")
             alert("Please enter a value");
    </script>
    Thanks,
    Sridhar

Maybe you are looking for

  • How to seperate a certain set of data..?

    Hi everyone. I am making a measurement. In this measurement there are let say 1000 value. I want to take 100 specific value for further analysis. For this, I want to index those data which I want and calculate them, then continue doing next measureme

  • Using SQL in Query in 3.0.0

    I'm very happy to see this feature added to 3.0.0 along with methodQL. This should alleviate a lot of the issues with trying to use only JDOQL, especially when the desired SQL statemetn is well understood. Thanks for adding this! Ben

  • DnD - Get Drop Mouse Position

    I want to Drag some image file from a JList, and then drop it on a JPanel. The dropping on the panel functions. The problem is, i would like to get the position of the mouse, when the item is dropped on the panel. I use the panel to visualize graphic

  • IDOC-- JDBC server with synchronous communication.

    Hi  SAP PI Experts, we have requirement as per the below. could you suggest the best possible way to execute this below. we need to send the outbound IDOC to JDBC and reponse file from JDBC should be posted to ECC in IDOC format. as per my knowledge

  • Searching for photos without tags?

    In  LR4 I have lots of images without tags. How can I search for all of my imported images that do not have tags? Thanks.