Hi,
encodeRedirectUrl(string url) is used when you don't have cookies supported in the destination browser. It adds the jsessionid as part of the url. Its called Url Re-writing.
When using sendRedirect using the normal url in browsers that don't support cookies, the browser client will not participate in the current session. To enable this, you have to explicitly make the client a part of the current session.
Eg:
String url =
http://mywebsite/accountinfo sendRedirect(url) -----------> not Wrong, but will not give expected results.
sendRedirect(encodeRedirectUrl(url)) ---------------> Will give expected results.
Hope this helps.