The Official Microsoft IIS Site

Distribuir contenido
The platform that enables you to build rich, interactive communities
Actualizado: hace 1 día 1 hora

Information about HeartBleed and IIS

Jue, 10/04/2014 - 03:58
The Heartbleed vulnerability in OpenSSL ( CVE-2014-0160 ) has received a significant amount of attention recently. While the discovered issue is specific to OpenSSL, many customers are wondering whether this affects Microsoft’s offerings, specifically Windows and IIS.  Microsoft Account and Microsoft Azure, along with most Microsoft Services, were not impacted by the OpenSSL vulnerability. Windows’ implementation of SSL/TLS was also not impacted. We also want to assure our customers that default...(read more)

FTP ETW Tracing and IIS 8 - Part 2

Mié, 09/04/2014 - 18:17

Shortly after I published my FTP ETW Tracing and IIS 8 blog post, I was using the batch file from that blog to troubleshoot an issue that I was having with a custom FTP provider. One of the columns which I display in my results is Clock-Time, which is obviously a sequential timestamp that is used to indicate the time and order in which the events occurred.

(Click the following image to view it full-size.)

At first glance the Clock-Time values might appear to be a range of useless numbers, but I use Clock-Time values quite often when I import the data from my ETW traces into something like Excel and I need to sort the data by the various columns.

That being said, apart from keeping the trace events in order, Clock-Time isn't a very user-friendly value. However, LogParser has some great built-in functions for crunching date/time values, so I decided to update the script to take advantage of some LogParser coolness and reformat the Clock-Time value into a human-readable Date/Time value.

My first order of business was to figure out how to decode the Clock-Time value; since Clock-Time increases for each event, it is obviously an offset from some constant, and after a bit of searching I found that the Clock-Time value is the offset in 100-nanosecond intervals since midnight on January 1, 1601. (Windows uses that value in a lot of places, not just ETW.) Once I had that information, it was pretty easy to come up with a LogParser formula to convert the Clock-Time value into the local time for my system, which is much easier to read.

With that in mind, here is the modified batch file:

@echo off

rem ======================================================================

rem Clean up old log files
for %%a in (ETL CSV) do if exist "%~n0.%%a" del "%~n0.%%a"

echo Starting the ETW session for full FTP tracing...
LogMan.exe start "%~n0" -p "IIS: Ftp Server" 255 5 -ets
echo.
echo Now reproduce your problem.
echo.
echo After you have reproduced your issue, hit any key to close the FTP
echo tracing session. Your trace events will be displayed automatically.
echo.
pause>nul

rem ======================================================================

echo.
echo Closing the ETW session for full FTP tracing...
LogMan.exe stop "%~n0" -ets

rem ======================================================================

echo.
echo Parsing the results - this may take a long time depending on the size of the trace...
if exist "%~n0.etl" (
   TraceRpt.exe "%~n0.etl" -o "%~n0.csv" -of CSV
   LogParser.exe "SELECT [Clock-Time], TO_LOCALTIME(ADD(TO_TIMESTAMP('1601-01-01 00:00:00', 'yyyy-MM-dd hh:mm:ss'), TO_TIMESTAMP(DIV([Clock-Time],10000000)))) AS [Date/Time], [Event Name], Type, [User Data] FROM '%~n0.csv'" -i:csv -e 2 -o:DATAGRID -rtp 20
)

When you run this new batch file, it will display an additional "Date/Time" column with a more-informative value in local time for the sever where you captured the trace.

(Click the following image to view it full-size.)

The new Date/Time column is considerably more practical, so I'll probably keep it in the batch file that I use when I am troubleshooting. You will also notice that I kept the original Clock-Time column; I chose to do so because I will undoubtedly continue to use that column for sorting when I import the data into something else, but you can safely remove that column if you would prefer to use only the new Date/Time value.

That wraps it up for today's post. :-)

(Cross-posted from http://blogs.msdn.com/robert_mcmurray/)

FTP ETW Tracing and IIS 8

Mar, 08/04/2014 - 23:35

In the past I have written a couple of blogs about using the FTP service's Event Tracing for Windows (ETW) features to troubleshoot issues; see FTP and ETW Tracing and Troubleshooting Custom FTP Providers with ETW for details. Those blog posts contain batch files which use the built-in Windows LogMan utility to capture an ETW trace, and they use downloadable LogParser utility to parse the results into human-readable form. I use the batch files from those blogs quite often, and I tend to use them a lot when I am developing custom FTP providers which add new functionality to my FTP servers.

Unfortunately, sometime around the release of Windows 8 and Windows Server 2012 I discovered that the ETW format had changed, and the current version of LogParser (version 2.2) cannot read the new ETW files. When you try to use the batch files from my blog with IIS 8, you see the following errors:

Verifying that LogParser.exe is in the path...
Done.

Starting the ETW session for full FTP tracing...
The command completed successfully.

Now reproduce your problem.

After you have reproduced your issue, hit any key to close the FTP tracing session. Your trace events will be displayed automatically.

Closing the ETW session for full FTP tracing...
The command completed successfully.

Parsing the results - this may take a long time depending on the size of the trace...
Task aborted.
Cannot open <from-entity>: Trace file "C:\temp\ftp.etl" has been created on a OS version (6.3) that is not compatible with the current OS version


Statistics:
-----------
Elements processed: 0
Elements output: 0
Execution time: 0.06 seconds

I meant to research a workaround at the time, but one thing led to another and I simply forgot about doing so. But I needed to use ETW the other day when I was developing something, so that seemed like a good time to quit slacking and come up with an answer. :-)

With that in mind, I came up with a very easy workaround, which I will present here. Once again, this batch file has a requirement on LogParser being installed on your system, but for the sake of brevity I have removed the lines from this version of the batch file which check for LogParser. (You can copy those lines from my previous blog posts if you want that functionality restored.)

Here's the way that this workaround is implemented: instead of creating an ETW log and then parsing it directly with LogParser, this new batch file invokes the built-in Windows TraceRpt command to parse the ETW file and save the results as a CSV file, which is then read by LogParser to view the results in a datagrid like the batch files in my previous blogs:

@echo off

rem ======================================================================

rem Clean up old log files
for %%a in (ETL CSV) do if exist "%~n0.%%a" del "%~n0.%%a"

echo Starting the ETW session for full FTP tracing...
LogMan.exe start "%~n0" -p "IIS: Ftp Server" 255 5 -ets
echo.
echo Now reproduce your problem.
echo.
echo After you have reproduced your issue, hit any key to close the FTP
echo tracing session. Your trace events will be displayed automatically.
echo.
pause>nul

rem ======================================================================

echo.
echo Closing the ETW session for full FTP tracing...
LogMan.exe stop "%~n0" -ets

rem ======================================================================

echo.
echo Parsing the results - this may take a long time depending on the size of the trace...
if exist "%~n0.etl" (
   TraceRpt.exe "%~n0.etl" -o "%~n0.csv" -of CSV
   LogParser.exe "SELECT [Clock-Time], [Event Name], Type, [User Data] FROM '%~n0.csv'" -i:csv -e 2 -o:DATAGRID -rtp 20
)

Here's another great thing about this new batch file - it will also work down-level on Windows 7 and Windows Server 2008; so if you have been using my previous batch files with IIS 7 - you can simply replace your old batch file with this new version. You will see a few differences between the results from my old batch files and this new version, namely that I included a couple of extra columns that I like to use for troubleshooting.

(Click the following image to view it full-size.)

There is one last thing which I would like to mention in closing: I realize that it would be much easier on everyone if Microsoft simply released a new version of LogParser which works with the new ETW format, but unfortunately there are no plans at the moment to release a new version of LogParser. And trust me - I'm just as depressed about that fact as anyone else. :-(

(Cross-posted from http://blogs.msdn.com/robert_mcmurray/)

Kudu for Azure Websites updated with ‘Process Explorer’ tab

Sáb, 05/04/2014 - 03:54

I’m sure everyone appreciates the pace in which Azure Websites team releasing cool features. Azure Websites was all over the announcements in the recent //build. The team has updated the Kudu console with new tab named ‘Process Explorer’. You will see it in the list of options available in the site. To access the Kudu console, go to https://yourwebsite.scm.azurewebsites.net (note the https, and .scm in the url).

Read more about this here.

Announcing:Smooth Streaming Plugin for OSMF with WAMS MPEG-DASH support (Beta)

Vie, 04/04/2014 - 22:08
Windows Azure Media Services team is very pleased to announce beta version of Microsoft Smooth Streaming plugin for OSMF with WAMS MPEG-DASH support.  <?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />Using Smooth Streaming OSMF plugin, you can add Smooth Streaming and Windows Azure Media Services on-demand MPEG-DASH(beta) content playback capabilities to existing OSMF and Strobe Media Playback players and furthermore build rich media experiences for Adobe Flash Player endpoints using Windows Azure Media Services you use today to target Smooth Streaming playback to other devices like Win8 store apps, browser and so on. This version of the Smooth Streaming plugin includes the following capabilities and works with OSMF 2.0 APIs:
  • On-demand Smooth Streaming/Windows Azure Media Services on-demand MPEG-DASH playback (Play, Pause, Seek, Stop)
  • Live Smooth Streaming playback (Play)
  • Live DVR functions (Pause, Seek, DVR Playback, Go-to-Live)
  • Support for video codecs – H.264
  • Support for Audio codecs – AAC
  • Multiple audio language switching with OSMF built-in APIs
  • Max playback quality selection with OSMF built-in APIs
  • This version only supports OSMF 2.0

Note:  This is a prerelease software and features, support and APIs are subject to change!

The initial release notes are available through MS Download Center and can be found here. For getting started with this new plugin, you can download the Smooth Streaming plugin for OSMF from the MS Download Center. Basic information for building an OSMF player with Smooth Streaming plugin and loading Smooth Streaming dynamic plugin to Strobe Media Player, can be found here.

To enable Windows Azure Media Services MPEG-DASH support:

Please refer to Dynamic Packaging configuration page and also here is a great post from my colleague John Deutcher for how to details (MPEG DASH preview from Windows Azure Media Services).  

Feedback

If you have feature requests, or want to provide general feedback—we want to hear it all! Please use the Smooth Streaming plugin for OSMF Forum thread to let us know what’s working, what isn’t, and how we can improve your Smooth Streaming development experience for OSMF applications. 

Installing WordPress, PHP, and MySQL on Windows Server 2012 R2

Jue, 03/04/2014 - 01:21
Microsoft’s Web Platform Installer (Web PI) makes installing applications a breeze. In a recent blog post I covered just how easy installing IIS has become using Web PI. In this walkthrough I’m going to cover installing WordPress, PHP, and MySQL using Web PI. I remember the days when installing these applications was a manual process. Depending on your level of expertise it was quite a challenge to get everything working properly. If you’ve ever tried to uninstall and then reinstall MySQL you know...(read more)

Announcing: Microsoft Smooth Streaming Client SDK for Windows Phone 8.1

Mié, 02/04/2014 - 23:00

Windows Azure Media Services team is very pleased to announce Smooth Streaming Client SDK for Windows Phone 8.1 aligned with the announcement of Windows Phone 8.1 at //Build/ conference today.

This release includes the same features as Smooth Streaming Client SDK for Windows 8/8.1 and also uses the same API set which will help unifying development afford across Windows, Windows Phone and XBOX ONE applications.<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

 

 

 

 Smooth Streaming Client SDK release supports:

  • WP 8.1 store app XAML and HTML5/JS applications
  • On-demand Playback (Play, Pause, Seek, Stop)
  • Live playback with seeking capabilities (Play, Pause, Seek, Go-to-Live)*
  • Support for video codes - H.264, VC-1
  • Support for Audio codecs - AAC, WMA Pro
  • Multiple audio language switching with APIs*
  • Track-selection for playback (for example, restrict the available bitrates)*
  • Text and Spare Track APIs*
  • Content protection - Microsoft PlayReady integration.(PlayReady SDK can be downloaded from here)
  • Trickplay (slow motion, fast-forward and rewind)
(**) this version is only supported on Windows Phone 8.1 and with Visual Studio 2013 update 2. You can get the Windows 8 version from here and Windows 8.1 version from here.

(*) Some of these features aren't supported with Windows Phone 8.1 default APIs. To enable these features, you need to use the Smooth Streaming Client SDK APIs.

Getting started 

Announcing: Microsoft Smooth Streaming Client 2.5 with MPEG DASH support

Mié, 02/04/2014 - 22:37

The PlayReady team, working in conjunction with the Windows Azure Media Services team is pleased to announce the availability of the Microsoft Smooth Streaming Client 2.5 with MPEG DASH support. This release adds the ability to parse and play MPEG DASH manifests in the Smooth Streaming Media Engine (SSME) to provide a Windows7/Windows8 and MacOS solution using MPEG DASH for On-Demand scenarios.

<?xml:namespace prefix = "o" />Developers that wish to move content libraries to DASH have the option of using DASH in places where Silverlight is supported. The existing SSME object model forms the basis of DASH support in the SSME. For example, DASH concepts like Adaptation Sets and Representations have been mapped to their logical counterpart in the SSME. Also, Adaptation Sets are exposed as Smooth Streams and Representations are exposed as Smooth Tracks. Existing Track selection and restriction APIs can be expected to function identically for Smooth and DASH content. In most other respects, DASH support is transparent to the user and a programmer who has worked with the SSME APIs can expect the same developer experience when working with DASH content.

Some details on the DASH support compared to Client 2.0:

  • A new value of ‘DASH’ has been added to the ManifestType enum. DASH content that has been mapped into Smooth can be identified by checking this property on the ManifestInfo object. Additionally the ManifestInfo object’s version is set to 4.0 for DASH content.
  • Support has been added for the four DASH Live Profile Addressing modes: Segment List, Segment Timeline, Segment Number, and Byte Range
    • For byte range addressable content, segments defined in the SIDX box map 1:1 with Chunks for the track.
  • A new property, MinByteRangeChunkLengthSeconds, has been added to Playback Settings to provide SSME with a hint at the desired chunk duration.
  • Multiple movie fragments will be addressed in a single chunk such that all but the last chunk will have a duration greater than or equal to this property. For examples of how to set Playback Settings see the Smooth documentation.
<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />There are some limitations in this DASH release, including:
  • Dynamic MPD types are not supported
  • Multiple Periods are not supported in an MPD
  • The EMSG box is not supported.
  • The codec and content limitations that apply to Smooth similarly apply to DASH. (see http://msdn.microsoft.com/en-us/library/cc189080(v=vs.95).aspx)
  • Seeking is supported, but not trick play. Playback rate must be 1.
  • Multiplexed streams are not supported.
For more information and getting started with this new SDK, you can download the Smooth Streaming Client 2.5 from the MS Download Center.

Feedback

If you have feature requests, or want to provide general feedback—we want to hear it all! Please use the Smooth Streaming Client 2.5 forum thread to let us know what’s working.

Top support solutions!

Mié, 02/04/2014 - 01:42
Having been around for so long, and encompassing so many technologies, information about using IIS and solving problems is more than abundant. The IIS.Net website alone has thousands of article, which can make it challenging to find what you need. To make things easier for IIS and other products, Microsoft support has setup a new blog resource called “Top Support Solutions”, which offers a hand-picked selection of links and information about Microsoft’s leading products. Wei Zhao from Microsoft support...(read more)

Ten down and counting

Mar, 01/04/2014 - 14:01
As much as I like practical jokes, a day like April Fools’ Day hardly seems like a time for celebration. But that it is. Ten years ago today, I began an adventure that brought me to where I am today. After a comprehensive interview process, I was offered a position that would start on April 1. I though surely it must be an April Fool’s joke. But, 10 years later, I am still employed with OrcsWeb , a company that provided managed hosting solutions. The last ten years as a systems administrator...(read more)

March 2014 IIS Community Newsletter

Dom, 30/03/2014 - 15:46
The March 2014 Edition of the IIS Community Newsletter has been published. You’ll want to check it out for some of the latest news and highlights in the IIS community over the past month. Best of all your blog posts and knowledge contribute to it and help make it all possible! http://www.iisnewsletter.com/archive/march2014.html Don’t forget to subscribe today and have it delivered directly to your inbox. http://www.iisnewsletter.com/subscribe.aspx We appreciate your support and love to...(read more)

Azure Web Sites – Continuous Deployment with Staged Publishing

Jue, 27/03/2014 - 22:04
In the beginning of the year Windows Azure Web Sites team has released a preview of the Staged Publishing functionality. The Staged Publishing allows you to create a staging site slot where you can publish a new version of the website and then test it before swapping to the production environment. This feature together with Continuous Deployment via GitHub, BitBucket or DropBox enables some very powerful deployment scenarios. However the preview release did not provide the optimal experience for...(read more)

Convert a Folder to an Application on a Remote IIS Host

Mar, 25/03/2014 - 15:07
The topic recently came up of the best way to convert a folder to an application on remote shared hosting server. Some hosts may have this built-in to their control panel. I know many (like Cytanium) have options in the … Read more »...(read more)

Personalizing Removable Drive Icons for Windows Explorer

Sáb, 22/03/2014 - 08:52
Like most people these days, I tend to swap a lot of removable storage devices between my ever-growing assortment of computing devices. The trouble is, I also have an ever-growing collection of removable storage devices, so it gets difficult keeping track of which device is which when I view them in Windows Explorer. The default images are pretty generic, and even though I try to use meaningful names, most of the drives look the same: By using a simple and under-used Windows feature, I have been...(read more)

RFC 7151 - File Transfer Protocol HOST Command for Virtual Hosts

Vie, 14/03/2014 - 12:32

I received an email yesterday from the RFC Editor that a new Request for Comments (RFC) document has just been published, RFC 7151, which adds support for a new "HOST" command to FTP. This new command allows hosting multiple FTP sites on a single IP address, much like what Host Headers provide for HTTP.

Here's the URL to the new RFC on the RFC Editor website:

File Transfer Protocol HOST Command for Virtual Hosts
http://www.ietf.org/rfc/rfc7151.txt

Or you can see the HTML-based version at the following URL:

http://tools.ietf.org/html/rfc7151

One minor point which I would like to clarify is that this adds a new command for FTP to specify which virtual host to connect to. I periodically hear people referring to this as "FTP Host Headers", but that is technically incorrect since FTP does not have request headers like HTTP. Here's a simple example of what the communications flow looks like when the HOST command is used:

CLIENT> HOST ftp.example.com SERVER> 220 Host accepted CLIENT> USER foo SERVER> 331 Password required CLIENT> PASS bar SERVER> 230 User logged in

I need to make sure that I thank my co-author for this RFC, Paul Hethmon, who has authored other FTP-related RFCs over the years. For example, Paul wrote RFC 3659, and he co-wrote RFC 2389 with Robert Elz. As a result, the Internet community has Paul and Robert to thank for several great FTP command extensions in the past. (e.g. FEAT, OPTS, MDTM, SIZE, REST, MLST, MLSD, etc.) Paul and I co-wrote RFC 7151 over the past several years, and it was great working with him.

Support for the HOST command has been built-in to Microsoft's FTP service since IIS 7.0, but now that the RFC has been officially published I hope that this feature will be adopted by other FTP servers and clients. That being said, IIS is not the only implementation of the FTP HOST command; at the time of this blog post, these are the server and client implementations that I am aware of which already provide support for this new command. (Note: there may be more than I have listed here; these are just the implementations that I currently know about.)

In addition to the clients listed above, if you have been reading my series on FTP clients over the past few years, I have posted details on how to use the FTP HOST command with some other FTP clients which do not provide built-in support. For example, the Core FTP Client allows you to specific pre-login commands as part of an FTP site's connection properties, so you can manually type in the HOST command and save it along the site's settings.

A Little Bit of History

When I joined the feature team which was creating the FTP service for Windows Server 2008, one of the things that bothered us was that there was no way at the protocol level to host multiple FTP sites on the same IP address. There were several ways that FTP server implementations were approximating that sort of functionality, for example the User Isolation features that we ship with FTP for IIS, but each FTP server seemed to be implementing its own workaround and there was no standardization.

Because of this limitation, our team received a lot of requests to add "FTP Host Headers," although as I explained earlier FTP has no concept of request headers. To help address some of the questions which I was often seeing, I explained the lack of hostname support for FTP in detail in the comments section of my FTP User Isolation with Multiple User Accounts blog that I posted back in 2006, which was shortly before we began work on implementing the HOST command. I will paraphrase some of my comments here:

While I realize that the ability host multiple FTP sites on the same IP address and port like HTTP is a desired configuration, the simple answer is that FTP does not currently support this at the protocol level. To put things in perspective, RFC 959 is the governing document for FTP, and that was published in October of 1985. FTP was simply not designed for the Internet as we use and understand it today, even though it is a generally reliable protocol that many people will continue to use for some time. HTTP/1.1 was designed much later and resolved this problem, but only for HTTP requests.

There are three ways that you can create unique bindings for a web or HTTP site: IP address, port, or host header. FTP can create unique bindings by IP address or port, but the FTP protocol does not currently provide support for hostnames.

Here's why: HTTP packets consist of a set of request headers and possibly a block of data. Here's an example of a simple GET request:

GET /default.aspx HTTP/1.0 [CrLf] Accept: */* [CrLf] [CrLf]

When HTTP 1.1 was published in RFC 2068 and RFC 2616, it defined a header for specifying a "host" name in a separate name/value pair:

GET /default.aspx HTTP/1.1 [CrLf] Host: example.com [CrLf] Accept: */* [CrLf] [CrLf]

The "Host" header allows multiple HTTP virtual servers ("hosts") on the same IP address and port that are differentiated by host name. While this works great for the HTTP protocol, FTP currently has no comparable functionality. As such, the FTP protocol would have to be updated to allow multiple hosts on the same IP address and port, then FTP servers and clients would need to be updated to accommodate the changes to FTP.

While my explanation may have clarified root cause of the FTP limitation for anyone who was asking about it, I personally thought the situation was unacceptable. This inspired me to research the addition of a new command for FTP which would allow FTP clients to specify hostnames. As I was researching how to propose a new RFC document to the IETF, I discovered that Paul Hethmon had been researching the same problem a few years earlier. I contacted Paul and offered to combine our work, and he agreed. After several years of work and a great deal of supportive assistance from dozens of great people whom I met through the IETF, RFC 7151 has finally been published.

There are a lot of people besides Paul whom I should thank, and we mention them in the acknowledgments section of our RFC, which you can read at the following URL:

http://tools.ietf.org/html/rfc7151#appendix-B

One final note - two of my coworkers, Jaroslav Dunajsky and Wade Hilmo, are mentioned in the acknowledgments section of the RFC. Jaroslav is the developer who implemented the FTP HOST command for IIS, and Wade is a senior developer on the IIS team who graciously allowed me to bounce ideas off him while I was doing my research over the past few years. (I probably I owe him a lunch or two.)

(Cross-posted from http://blogs.msdn.com/robert_mcmurray/)

Huge growth in Microsoft’s market share for web servers!

Mar, 11/03/2014 - 19:07
Millions of people out there are using IIS to host their websites, but we all know it’s not the only product on the market. For many years, Apache was leading with a significant margin, but things are finally starting to change. According to NetCraft, a research company from the UK which specializes in analyzing the web and hosting market, IIS has had a huge spike in market share recently. According to the report they released a few days ago, IIS had almost 50 million new sites during February, increasing...(read more)

Monitor a site’s downtime…for free!

Vie, 07/03/2014 - 15:33
You have a really cool website that you or someone else designed, right? That’s great but it doesn’t do you much good if the site is down. Nobody can get to it and learn about your product or service, or even worse, buy something from you if it’s an ecommerce site. I know, it’s hosted by someone and they monitor it, right? Probably not. You can check with them, but most hosts don’t monitor sites by default. In many cases you should consider an external monitoring service. There are many out there...(read more)

IIS: Using Windows Authentication with Minimal Permissions Granted to Disk

Lun, 03/03/2014 - 20:37
I had a question asked me recently regarding Windows auth and NTFS permissions. Here’s the question: When I run an IIS site using Windows Authentication, is there a way to let the Application Pool account access files in disk instead of the logged in Read More......(read more)

FTP Clients - Part 13: WinSCP

Sáb, 01/03/2014 - 07:57

For this next installment in my series about FTP clients, I want to take a look at WinSCP, which is an open source FTP/SFTP client that is available from the following URL:

http://www.winscp.net/

For this blog post I used WinSCP 5.5.1, and it was available for free when I wrote this blog post. That being said, WinSCP's author (Martin Prikryl) takes donations. (And I think that it's a worthy cause; I like to support independent development work.)

WinSCP 5.5 Overview

When you open WinSCP 5.5, you will first see the Login dialog box, which will be empty until you add some sites to the list. The Login dialog allows you to create folders so you can categorize your sites, and the user interface is comparable to what you would expect in a Site Manager for other FTP clients.

Fig. 1 - The opening Login dialog in WinSCP 5.5.

When you are adding FTP sites, you have three choices for the protocol: FTP, SCP, and SFTP; you also have four choices for encryption: No encryption, TLS/SSL Implicit encryption, TLS Explicit encryption, and SSL Explicit encryption. (I'll discuss those later.)

When you open a site for which you did not save the password, (which I highly recommend), you will be prompted for your password.

Fig. 2 - The WinSCP 5.5 Password dialog.

Once your FTP site is opened, the main application window is displayed, and it resembles a two-column file explorer interface with local and remote folders, which you might expect from a GUI-based FTP client. (Note: WinSCP refers to this as it's "Commander" interface.)

Fig. 3 - Local and Remote Folders.

That being said, if you change your application preferences, you can change the user interface so that it uses a single-column file explorer interface with a folder tree, which might be useful if you would rather use the FTP client as a drag-and-drop repository. (Note: WinSCP refers to this as it's "Explorer" interface.)

Fig. 4 - Remote Folder Tree and Files.

WinSCP 5.5 has support for automation through .NET and COM, and documentation about automating WinSCP 5.5 programmatically is available on the WinSCP website at the following URL:

WinSCP .NET Assembly and COM Library

There are several detailed automation examples on the WinSCP website that are written in C#, VB.NET, PowerShell, JavaScript, VBScript, etc., and the documentation is quite good. If you need to do a lot of FTP scripting and you are looking for a good way to automate your FTP sessions, you might want to consider this FTP client.

If you don't want to write a bunch of code, you can also automate WinSCP from a command line, and the documentation about that is available on the WinSCP website at the following URL:

WinSCP Command-line Options

Another great feature about WinSCP is that it can be downloaded as portable executables, which makes it easy to copy between systems. This is a great feature for me since I like to keep a collection of handy utilities in my SkyDrive/OneDrive folders.

Using WinSCP 5.5 with FTP over SSL (FTPS)

WinSCP 5.5 has built-in support for FTP over SSL (FTPS), and it supports both Explicit and Implicit FTPS. To specify which type of encryption to use for FTPS, you need to choose the appropriate option from the Encryption drop-down menu for an FTP site.

Fig. 5 - Specifying the FTPS encryption.

Once you have established an FTPS connection through WinSCP 5.5, the user experience is the same as it is for a standard FTP connection. That being said, I could not find a way to drop out of FTPS once a connection is established, so FTPS is an all or nothing option for your sessions.

Using Using WinSCP 5.5 with True FTP Hosts

True FTP hosts are not supported natively, and even though WinSCP 5.5 allows you to send post-login commands after an FTP site has been opened, I could not find a way to send a custom command before sending user credentials, so true FTP hosts cannot be used.

Using Using WinSCP 5.5 with Virtual FTP Hosts

WinSCP 5.5's login settings allow you to specify the virtual host name as part of the user credentials by using syntax like "ftp.example.com|username" or "ftp.example.com\username", so you can use virtual FTP hosts with WinSCP 5.5.

Fig. 6 - Specifying an FTP virtual host. Scorecard for WinSCP 5.5

This concludes my quick look at a few of the FTP features that are available with WinSCP 5.5, and here are the scorecard results:

Client
NameDirectory
BrowsingExplicit
FTPS
Implicit
FTPS
Virtual
Hosts
True
HOSTs
Site
ManagerExtensibility WinSCP 5.5.1 Rich Y Y Y N Y N/A Note: I could not find anyway to extend the functionality of WinSCP 5.5; but as I said
earlier, it provides rich automation features for .NET, COM, and the command-line.

That wraps things up for today's blog. Your key take-aways should be: WinSCP 5.5 is good FTP client with a lot of options, and it has a very powerful automation story. As I mentioned earlier, if you have to do a lot of FTP automation, you should really take a look at this FTP client.

(Cross-posted from http://blogs.msdn.com/robert_mcmurray/)

Adding Additional Content Types to my Classic ASP and URL Rewrite Samples for Dynamic SEO Functionality

Sáb, 01/03/2014 - 02:43

In December of 2012 I wrote a blog titled "Using Classic ASP and URL Rewrite for Dynamic SEO Functionality", in which I described how to use Classic ASP and URL Rewrite to dynamically-generate Robots.txt and Sitemap.xml or Sitemap.txt files. I received a bunch of requests for additional information, so I wrote a follow-up blog this past November titled "Revisiting My Classic ASP and URL Rewrite for Dynamic SEO Functionality Examples" which illustrated how to limit the output for the Robots.asp and Sitemap.asp files to specific sections of your website.

That being said, I continue to receive requests for additional ways to stretch those samples, so I thought that I would write at least a couple of blogs on the subject. With that in mind, for today I wanted to show how you can add additional content types to the samples.

Overview

Here is a common question that I have been asked by several people:

"The example only works with *.html files; how do I include my other files?"

That's a great question, and additional content types are really easy to implement, and the majority of the code from my original blog will remain unchanged. Here's the file by file breakdown for the changes that need made:

FilenameChanges Robots.asp None Sitemap.asp See the sample later in this blog Web.config None

If you are already using the files from my original blog, no changes need to be made to your Robots.asp file or the URL Rewrite rules in your Web.config file because the updates in this blog will only impact the output from the Sitemap.asp file.

Updating the Sitemap.asp File

My original sample contained a line of code which read "If StrComp(strExt,"html",vbTextCompare)=0 Then" and this line was used to restrict the sitemap output to static *.html files. For this new sample I need to make two changes:

  1. I am adding a string constant which contains a list of file extensions from several content types to use for the output.
  2. I replace the line of code which performs the comparison.

Note: I define the constant near the beginning of the file so it's easier for other people to find; I would normally define that constant elsewhere in the code.

<% Option Explicit On Error Resume Next Const strContentTypes = "htm|html|asp|aspx|txt" Response.Clear Response.Buffer = True Response.AddHeader "Connection", "Keep-Alive" Response.CacheControl = "public" Dim strFolderArray, lngFolderArray Dim strUrlRoot, strPhysicalRoot, strFormat Dim strUrlRelative, strExt Dim objFSO, objFolder, objFile strPhysicalRoot = Server.MapPath("/") Set objFSO = Server.CreateObject("Scripting.Filesystemobject") strUrlRoot = "http://" & Request.ServerVariables("HTTP_HOST") ' Check for XML or TXT format. If UCase(Trim(Request("format")))="XML" Then strFormat = "XML" Response.ContentType = "text/xml" Else strFormat = "TXT" Response.ContentType = "text/plain" End If ' Add the UTF-8 Byte Order Mark. Response.Write Chr(CByte("&hEF")) Response.Write Chr(CByte("&hBB")) Response.Write Chr(CByte("&hBF")) If strFormat = "XML" Then Response.Write "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf Response.Write "<urlset xmlns=""http://www.sitemaps.org/schemas/sitemap/0.9"">" & vbCrLf End if ' Always output the root of the website. Call WriteUrl(strUrlRoot,Now,"weekly",strFormat) ' -------------------------------------------------- ' This following section contains the logic to parse ' the directory tree and return URLs based on the ' files that it locates. ' -------------------------------------------------- strFolderArray = GetFolderTree(strPhysicalRoot) For lngFolderArray = 1 to UBound(strFolderArray) strUrlRelative = Replace(Mid(strFolderArray(lngFolderArray),Len(strPhysicalRoot)+1),"\","/") Set objFolder = objFSO.GetFolder(Server.MapPath("." & strUrlRelative)) For Each objFile in objFolder.Files strExt = objFSO.GetExtensionName(objFile.Name) If InStr(1,strContentTypes,strExt,vbTextCompare) Then If StrComp(Left(objFile.Name,6),"google",vbTextCompare)<>0 Then Call WriteUrl(strUrlRoot & strUrlRelative & "/" & objFile.Name, objFile.DateLastModified, "weekly", strFormat) End If End If Next Next ' -------------------------------------------------- ' End of file system loop. ' -------------------------------------------------- If strFormat = "XML" Then Response.Write "</urlset>" End If Response.End ' ====================================================================== ' ' Outputs a sitemap URL to the client in XML or TXT format. ' ' tmpStrFreq = always|hourly|daily|weekly|monthly|yearly|never ' tmpStrFormat = TXT|XML ' ' ====================================================================== Sub WriteUrl(tmpStrUrl,tmpLastModified,tmpStrFreq,tmpStrFormat) On Error Resume Next Dim tmpDate : tmpDate = CDate(tmpLastModified) ' Check if the request is for XML or TXT and return the appropriate syntax. If tmpStrFormat = "XML" Then Response.Write " <url>" & vbCrLf Response.Write " <loc>" & Server.HtmlEncode(tmpStrUrl) & "</loc>" & vbCrLf Response.Write " <lastmod>" & Year(tmpLastModified) & "-" & Right("0" & Month(tmpLastModified),2) & "-" & Right("0" & Day(tmpLastModified),2) & "</lastmod>" & vbCrLf Response.Write " <changefreq>" & tmpStrFreq & "</changefreq>" & vbCrLf Response.Write " </url>" & vbCrLf Else Response.Write tmpStrUrl & vbCrLf End If End Sub ' ====================================================================== ' ' Returns a string array of folders under a root path ' ' ====================================================================== Function GetFolderTree(strBaseFolder) Dim tmpFolderCount,tmpBaseCount Dim tmpFolders() Dim tmpFSO,tmpFolder,tmpSubFolder ' Define the initial values for the folder counters. tmpFolderCount = 1 tmpBaseCount = 0 ' Dimension an array to hold the folder names. ReDim tmpFolders(1) ' Store the root folder in the array. tmpFolders(tmpFolderCount) = strBaseFolder ' Create file system object. Set tmpFSO = Server.CreateObject("Scripting.Filesystemobject") ' Loop while we still have folders to process. While tmpFolderCount <> tmpBaseCount ' Set up a folder object to a base folder. Set tmpFolder = tmpFSO.GetFolder(tmpFolders(tmpBaseCount+1)) ' Loop through the collection of subfolders for the base folder. For Each tmpSubFolder In tmpFolder.SubFolders ' Increment the folder count. tmpFolderCount = tmpFolderCount + 1 ' Increase the array size ReDim Preserve tmpFolders(tmpFolderCount) ' Store the folder name in the array. tmpFolders(tmpFolderCount) = tmpSubFolder.Path Next ' Increment the base folder counter. tmpBaseCount = tmpBaseCount + 1 Wend GetFolderTree = tmpFolders End Function %>

That's it. Pretty easy, eh?

I have also received several requests about creating a sitemap which contains URLs with query strings, but I'll cover that scenario in a later blog.

(Cross-posted from http://blogs.msdn.com/robert_mcmurray/)