Substring method allow us to retrieve a substring from a string object. Here this example code demonstrate us how can we get a substring from a string in .net framework.
This is caused because of Where-Expression. You should only use variables in there or call methods that can be translated to SQL. First, save your Session value in a variable.