the server responded with a status of 500 (Internal Server Error) in asp.net
<p>in my requirement autocomplete textbox. i am done with that . but some times it shows internal server error that time data was not display. full of errors 
this is my code how to solve it please help me .</p>

<pre><code>$(function () {
            SearchText();
        });
        function SearchText() {
            $(".autosuggest").autocomplete({
                source: function (request, response) {
                    var _reqObj = new Object();
                    _reqObj.username = document.getElementById('txtSearch').value;
                    _reqObj.Meth = "AB";

                    $.ajax({
                        type: "POST",
                        url: "../Harneedi2/api/Home",
                        contentType: 'application/json; charset=utf-8',
                        dataType: 'json',
                        data: _reqObj,
                        success: function (data) {
                            var list = data;
                            if (list.length &gt; 0) {
                                response($.map(list, function (item) {
                                    return {
                                        label: item.split('-')[0],
                                        val: item.split('-')[1]
                                    }

                                }));
                            }
                            else {
                                response([{ label: 'No Records Found', val: -1}]);
                            }

                        },
                        error: function (result) {
                            alert("Error...plz enter correct letter");
                        }
                    });
                },
                select: function (e, i) {
                    // $("[id$=hfspecializationID]").val(i.item.val);

                    // alert(i.item.val);
                }

            });
        }
        //space key disable &amp; cut copy paste
        $(function () {
            $('body').on('keydown', '#txtSearch', function (e) {
                console.log(this.value);
                if (e.which === 32 &amp;&amp; e.target.selectionStart === 0) {
                    return false;
                }
            });
        });
        //cut copy paste disable
        $(document).ready(function () {
            $('#txtSearch').bind('copy paste cut', function (e) {
                e.preventDefault(); //disable cut,copy,paste
               alert('cut,copy &amp; paste options are disabled !!');
            });
        });
</code></pre>