Twitter not shortening long urls automatically on share a link on Twitter page and not able to post the tweet due to more than 140 characters


I am using the following code :


As you can see the url is too long.And when i click this button it goes to share a link on twitter page and showing the text+url in the tweet box is more than 140 characters.
My Questions ?

  1. Is there any way the long url gets shortened automatically and allowing me tweet the message with out error.In case yes please help me on that.


Be sure and URL encode the URL you’re trying to share – it’s not valid to present it “naked” on the querystring like that.

You might also find it difficult to properly wrap URLs of this variety – IP address with port. Generally that’s not an above-the-board way to share content on Twitter.