.Net, CRM, IIS, MVC, Programming, Security, SharePoint, Sitecore, Troubleshooting, Visual Studio, Web, Web Service, Windows

Solved: The length of the URL for this request exceeds the configured maxUrlLength value.

Anyone ever run into the following before? I ran into this regarding a request into the SharePoint Rest API.

The length of the URL for this request exceeds the configured maxUrlLength value.

This because the IIS default maximum length for an URL is 260 characters. If a URL request is longer, the above error will occur.

To fix this you can increase the maxURLlength value, add it to your web.config file in the IIS virtual Directory.

<configuration>

  <system.web>

    <httpRuntime maxUrlLength="5000" />

  </system.web>

</configuration>

It will be likely you will already have most of this snippet in place so don’t break your config; just add the maxUrlLength property into your existing httpRuntime section and you should be good to go. Do know any web.config changes may cause a service interruption so test in dev, beta, QA and pre-prod before ever changing in prod! Hope this helps, questions are welcome!

.Net, IIS, Troubleshooting, Visual Studio, Web, Windows

Solved: Method not found: ‘!!0[] System.Array.Empty()’.

If you are getting a message for your recently developed .Net application when you publish to the server to the effect of:

ssnetframeworkerror

Chances are the server you are deploying to does not have the appropriate framework to support your app.

Download the Microsoft .Net Framework 4.6.1 and install it to resolve this. It will likely require a server reboot to complete it so don’t do it on prod mid-day! Hope this helps, questions are welcome!

PowerShell, Programming, Security, SharePoint, Troubleshooting, Windows

SharePoint/PowerShell – Get the AD groups associated with a site collection and output to CSV file

Need to deliver or better understand the AD groups associated with your SharePoint site collection? Try this:

$SPWebApp = Get-SPWebApplication http://sitecollectionURLhere/

foreach ($SPSite in $SPWebApp.Sites)
{
    write-host -foregroundcolor green "Working on Site Collection: " + $SPsite.RootWeb.Title 
    $SiteURL = $SPsite.RootWeb.URL
    $ADgroup=Get-SPUser -Web $SiteURL -Limit ALL | Where { $_.IsDomainGroup }
}
echo $ADgroup | Export-Csv "C:\Temp\FileNameGoesHere.csv"

PS1 download is here: https://1drv.ms/u/s!Ag4C3w6EUQIggowvfXrE0Z3tfWKJeA

Certificates, OpenSSL, Windows

Create .pem/.key/.crt Files from a .pfx Certificate Using OpenSSL on Windows

  1. First off, go and get OpenSSL:

Now that you are installed and ready to go you should now have a browsable file path to OpenSSL (i.e. C:\OpenSSL)

2. Obtain your PFX file and (for simplicity) place your PFX file in your OpenSSL directory.

(In this example we will assume we have a .pfx file called mycertificate.pfx and your OpenSSL directory is C:\OpenSSL)

3. Run this in command prompt (in your OpenSSL directory) to get the .pem file:

 
openssl pkcs12 -in mycertificate.pfx -out mypemfile.pem

You should now have a .pem file generated from your PFX file.

4. Run this in command prompt (in your OpenSSL directory) to extract the encrypted private key:

 
openssl pkcs12 -in mypemfile.pem -out myencryptedkey.key

You should now have the extracted encrypted private key out of the .pem file.

5. Run this in command prompt (in your OpenSSL directory) to create a decrypted private key from the encrypted version

 
openssl rsa -in myencryptedkey.key -out mydecryptedkey.key

You should now have the decrypted private key from your encrypted version.

6. Run this in command prompt (in your OpenSSL directory) to extract a .crt file from your PFX file:

 
openssl pkcs12 -in mycertificate.pfx -clcerts -nokeys -out certificate.crt

You should now an extracted .crt file from the PFX file.

That’s it! You should now have encrypted/decrypted keys as well as your .pem and .crt versions of your original PFX files. Happy certificating (I need to coin that term). Questions are always welcome.