Differences

This shows you the differences between the selected revisions of the page.

2015-12-18 2015-12-23
5.8 aching fingerprints of last verified host keys so they can be used in Generate URL function on Login dialog already. (martin) 5.8 Script or .NET assembly code template can be generated in GUI. (martin)
Line 1: Line 1:
-====== Generate URL Dialog ====== +====== Generate URL/Code Dialog ====== 
-Generate %%URL%% dialog is used to generate a [[session_url|session URL]] or a file URL.+Generate %%URL/code%% dialog is used to generate a [[session_url|session URL]], a file URL or a code template.
-To open the dialog use:+To open the dialog to generate the session %%URL%% or code, use:
-  * //Session > Generate %%URL%%// command on main window to generate session %%URL%% for current session. +  * //Session > Generate Session %%URL%%/Code// command on the main window to generate session %%URL%% or code template for the current session. (preferred) 
-  * //Manage > Generate %%URL%%// command on [[ui_login|Login dialog]] to generate session %%URL%% for selected site (this approach will not include host key fingerprint for SFTP/SCP sessions needed for scripting/.NET assembly). +  * //Manage > Generate Session %%URL/Code%%// command on the [[ui_login|Login dialog]] to generate session %%URL%% or code template for the selected site
-  * //File(s) > File Names > Generate %%URL%%// command on main window to generate file %%URL%% for files selected in remote [[ui_file_panel|file panel]].+ 
 +To open the dialog to generate the file %%URL%%, use: 
 + 
 +  * //File(s) > File Names > Generate File %%URL%%// command on main window to generate file %%URL%% for files selected in the remote [[ui_file_panel|file panel]]
 + 
 +&toc_title(The dialog has three tabs. Each is described individually.) 
 + 
 +===== URL Tab ===== 
 +Use the //%%URL%% tab// to generate a [[session_url|session URL]] or a file URL.
&screenshotpict(generateurl) &screenshotpict(generateurl)
-===== URL Options ===== +The generated %%URL%% always includes a protocol and a host name portions. Other parts can be included optionally. 
-Generated %%URL%% always includes protocol and host name portions. Other parts can be included optionally.+ 
 +Check the //User name// to include username into the %%URL%%. The option is not available when the dialog is opened from the Login dialog and the user name was not specified; or (rarely) when the current session did not require the user name. 
 + 
 +Check the //Password// to include password into the %%URL%%. Make sure you protect an %%URL%% that includes the password appropriately. The option is not available when the dialog is opened from the Login dialog and the password was not specified; or when the current session does not use a password authentication; or when [[security_credentials|the password was not stored nor remembered]]. 
 + 
 +Check the //%%SSH%% host key// to [[session_url#hostkey|include an SSH host key fingerprint into the URL]]. The option is available for an SFTP and an SCP (SSH-based) sessions only. The option may not available when the dialog is opened before the session is connected as the host key may not be known yet. &beta (*More precise wording once beta is released*) Note that some (most) SSH clients need not understand a session %%URL%% that includes the host key fingerprint. 
 + 
 +Check the //Initial directory// to include an initial remote directory into the %%URL%%. When the dialog is opened opened from the Login dialog, //Remote directory// as specified on the [[ui_login_directories|Advanced site settings dialog]] is used. When opened from the main window, the current working remote directory is used. The option is not available when generating an %%URL%% for selected file(s) as a path to the file(s) is used instead. 
 + 
 +Check the //WinSCP-specific// to generate an [[integration_url#winscp|WinSCP-specific URL]]. Note that you need to enable the option with the WebDAV protocol, if you want WinSCP to handle the %%URL%%, as WinSCP [[integration_url#registering|never registers]] for the ''http'' protocol. 
 + 
 +Check the //Save extension// to include a [[integration_url#save|save extension]] into the %%URL%%. As the extension is WinSCP-specific, the option //WinSCP-specific// should be selected along. 
 + 
 +The generated %%URL%%(s) is shown in the bottom box. When generating an %%URL%% for a site, only one %%URL%% is displayed. When generating an %%URL%% for a selected file(s), one %%URL%% per a file is displayed. 
 + 
 +===== Script Tab ===== 
 +Use the //Script tab// to generate a [[scripting|WinSCP script]] template for the session. &beta_feature 
 + 
 +&screenshotpict(generateurl_script) 
 + 
 +The script will include: 
 + 
 +  * the ''[[scriptcommand_open|open]]'' command with the [[session_url|session URL]] and all other switches needed to configure the session. 
 +  * a placeholder text to be replaced with [[scripting#commands|commands]]. 
 +  * the ''[[scriptcommand_exit|exit]]'' command to end the script. 
 + 
 +Use the //Format// to select a format of the script to generate: 
 + 
 +  * //Script file// - Generates a script file template that you execute using the ''/script'' [[commandline|command-line switch]].  
 +  * //Batch file// - Generates a Windows batch file (''.bat'') template that executes the ''[[executables|winscp.com]]'' with the above commands, specified using the ''/command'' command-line switch. Additionally the batch file enables [[logging|session logging]] using the ''/log'' switch and [[scripting#configuration|isolates the script run from a GUI configuration]] using the ''/ini=nul'' switch. At the end, the batch file [[scripting#result|checks WinSCP exit code]] to choose further actions to take; and propagates the WinSCP exit code to a batch file exit code using the ''exit /b'' command. 
 +  * //Command-line// - Generates a command-line for the ''[[executables|winscp.exe]]'' with the above commands, session logging and configuration isolation (see the previous point). The command-line is suitable for task managers of all kinds, like [[guide_schedule|Windows Scheduler]] or [[guide_ssis|SSIS]]. 
 + 
 +The script will not include options to [[scripting#hostkey|verify the host key or certificate]], if the session was not opened before yet. Open the session at least once, before generating the script.
-Check //User name// to include username into %%URL%%. The option is not available when dialog is opened from Login dialog and user name was not specified; or (rarely) when current session did not require user name.+===== .NET Assembly Tab ===== 
 +Use the //.NET assembly tab// to generate a code template using [[library|WinSCP .NET assembly]] for the session. &beta_feature
-Check //Password// to include password into %%URL%%. Make sure you protect %%URL%% that includes password appropriately. The option is not available when dialog is opened from Login dialog and password was not specified; or when current session does not use password authentication; or when [[security_credentials|password was not stored nor remembered]].+&screenshotpict(generateurl_code)
-Check //%%SSH%% host key// to [[session_url#hostkey|include SSH host key fingerprint into URL]]. The option is available for SFTP and SCP (SSH-based) sessions only. The option is not available when the dialog is opened from Login dialog as the host key is not known before session is opened //(This limitation is removed in the latest beta version)//. &beta Note that some (most) SSH clients need not understand session %%URL%% that includes host key fingerprint.+The code will:
-Check //Initial directory// to include initial remote directory into %%URL%%. When opened from Login dialog, //Remote directory// as specified on [[ui_login_directories|Advanced site settings dialog]] is used. When opened from main window, the current working remote directory is used. The option is not available when generating %%URL%% for selected file(s) as path to the file(s) is used instead.+  * Set up ''[[library_sessionoptions|SessionOptions]]'' with all properties needed to configure the session. 
 +  * Create ''[[library_session|Session]]'' instance. 
 +  * Open the session using ''[[library_session_open|Session.Open]]'' 
 +  * Include a placeholder text to be replaced with calls to ''Session'' [[library_session#methods|methods]]. 
 +  * Dispose the ''[[library_session|Session]]'' instance.
-Check //WinSCP-specific// to generate [[integration_url#winscp|WinSCP-specific URL]]. Note that you need to enable the option with WebDAV protocol, if you want WinSCP to handle the URL, as WinSCP [[integration_url#registering|never registers]] for ''http'' protocol.+Use the //Language// to select a language to generate the template for. Available languages are C#, VB.NET and [[library_powershell|PowerShell]].
-Check //Save extension// to include [[integration_url#save|save extension]] into %%URL%%. As the extension is WinSCP-specific, option //WinSCP-specific// should be selected along.+The code will not set properties to verify a host key (''[[library_sessionoptions#properties|SessionOptions.SshHostKeyFingerprint]]'') or a certificate (''[[library_sessionoptions#properties|SessionOptions.TlsHostCertificateFingerprint]]''), if the session was not opened before yet. Open the session at least once, before generating the code.
-===== Generated URL ===== +===== Copying Generated URL or Code to Clipboard =====
-Generated %%URL%%(s) are shown in bottom box. When generating %%URL%% for site, only one %%URL%% is displayed. When generating %%URL%% for selected file(s), one %%URL%% per file is displayed.+
-Use //Copy to Clipboard// to copy generated %%URL%%(s) to clipboard.+Use //Copy to Clipboard// to copy generated %%URL%%(s) or code to a clipboard.

Last modified: by martin