MSPBlock[{vari,…},body]
interprets the argument variables and replaces them in body.
MSPBlock[{vari,…},body,defvalue]
returns defvalue if any of the variables do not have values.


MSPBlock
MSPBlock[{vari,…},body]
interprets the argument variables and replaces them in body.
MSPBlock[{vari,…},body,defvalue]
returns defvalue if any of the variables do not have values.
Details
- This is one of the key ways to work with variables from the HTTP request.
- MSPBlock takes each of the variables vari, interprets them and then replaces any occurrences in body with the interpreted value.
- If any variables do not have values, an empty string is returned.
- The following exceptions can be thrown by MSPBlock:
-
MSPException["ParseError"] if the value cannot be interpreted by the Wolfram Kernel MSPException["SecurityError"] if the value does not pass the security test MSPException["ValueError"] if the value is not a string; this indicates a programmatic error by the page author MSPException["VariableError"] if the variable is not a Wolfram Language symbol; this indicates a programmatic error by the page author
Examples
Basic Examples (1)
You can simulate how the functions work by loading the package and setting the security content:
Here, the variable $$var is assigned the value "5+7"; note that the value is a string:
When MSPBlock evaluates, all occurrences of $$var are replaced by its interpreted value:
If the input value cannot be interpreted, an MSPException is thrown:
If the input value does not pass the security test, an MSPException is thrown:
Text
Wolfram Research (1996), MSPBlock, Wolfram Language function, https://reference.wolfram.com/language/WolframWebEngine/ref/MSPBlock.html.
CMS
Wolfram Language. 1996. "MSPBlock." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/WolframWebEngine/ref/MSPBlock.html.
APA
Wolfram Language. (1996). MSPBlock. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/WolframWebEngine/ref/MSPBlock.html
BibTeX
@misc{reference.wolfram_2025_mspblock, author="Wolfram Research", title="{MSPBlock}", year="1996", howpublished="\url{https://reference.wolfram.com/language/WolframWebEngine/ref/MSPBlock.html}", note=[Accessed: 25-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_mspblock, organization={Wolfram Research}, title={MSPBlock}, year={1996}, url={https://reference.wolfram.com/language/WolframWebEngine/ref/MSPBlock.html}, note=[Accessed: 25-August-2025]}