you need to make use of the Network Analyst like in Front end. Doing the route-solve proramatically needs to make all options in your code while in ArcMap you can use some default values and easy to use GUIs. I do not know which default values are available for your way.
Here's a good start to read how this is working. Use the SDK documentations-search for further information about specific points.