Click here to Skip to main content
15,868,141 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionIIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site Pin
Stephen Holdorf31-Jan-20 5:30
Stephen Holdorf31-Jan-20 5:30 
AnswerRe: IIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site Pin
Richard Deeming31-Jan-20 5:49
mveRichard Deeming31-Jan-20 5:49 
GeneralRe: IIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site Pin
Stephen Holdorf31-Jan-20 6:51
Stephen Holdorf31-Jan-20 6:51 
GeneralRe: IIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site Pin
Richard Deeming31-Jan-20 7:13
mveRichard Deeming31-Jan-20 7:13 
GeneralRe: IIS changing the IE11 document mode from 11 (Default) to 7 (Default) when browsing to a site Pin
Stephen Holdorf31-Jan-20 7:50
Stephen Holdorf31-Jan-20 7:50 
QuestionSQL and IIS error when publish an ASP .NET application to IIS Pin
Stephen Holdorf30-Jan-20 12:54
Stephen Holdorf30-Jan-20 12:54 
AnswerRe: SQL and IIS error when publish an ASP .NET application to IIS Pin
phil.o30-Jan-20 13:07
professionalphil.o30-Jan-20 13:07 
QuestionHow do I solve error StatusCode: 500? Pin
Member 1140330430-Jan-20 4:01
Member 1140330430-Jan-20 4:01 
I am getting an error when I try to get case information from a database (Justice)

Here is the error:
{StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{Pragma: no-cache Cache-Control: no-cache Date: Wed, 29 Jan 2020 22:07:12 GMT Server: Microsoft-IIS/8.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 6066 Content-Type: application/json; charset=utf-8 Expires: -1 }}


I need help to solve the error StatusCode: 500 When button is clicked JusticeContoller class is called. This is where I am getting an error on line response=await client.GetAsync("api/GetAllAcceptCAseNumbers/" + candidateCases);

C#
protected async void GetCasesButton_Click(object sender, EventArgs e)
{
    //#region Required Field Validation
    if (CaseNumbersTextBox.Text.Length < 1)
    {
        string myStringVariable = "Case number textbox cannot be empty.";
        ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
        return;
    }
        try
        {
        #region Get Batch Number
        int newBatchNumber = await CandidateCaseController.GetNextBatchNumber();
        #endregion
        #region Insert entered case numbers in database
			foreach (string caseNumber in userEnteredCaseNumberList)
            {
                EditCandidateCaseModel newCandidate = new EditCandidateCaseModel();
                newCandidate.CaseNbr = caseNumber;
                newCandidate.EntryStaffUserName = Helpers.Authentication.GetADEmail();
                await CandidateCaseController.PostCandidate(newCandidate);
            }
            #region Get MNCIS info on cases
            //candidateCasesString
            List<string> smallEnoughStrings = new List<string>();
            List<AcceptCaseNumbersModel> mncisDetailList = new List<AcceptCaseNumbersModel>();
            List<AcceptCaseNumbersModel> smallEnoughMncisDetailList = new List<AcceptCaseNumbersModel>();
            foreach (string smallEnoughString in smallEnoughStrings)
            {
                smallEnoughMncisDetailList = await FTACaseReseting.Controllers.JusticeController.GetAllAcceptCaseNumbers(smallEnoughString);
                mncisDetailList.AddRange(smallEnoughMncisDetailList);
            }
            #endregion
               
        }
        catch (Exception ex)
        {
            string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "GetCasesButton_Click()", ex.Message);
            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + errorMsg + "');", true);
        }
}


Here is the class called when button click even happens
C#
public class JusticeController
{
    #region Get
    public static async Task<List<AcceptCaseNumbersModel>> GetAllAcceptCaseNumbers(string candidateCases)
    {
        List<AcceptCaseNumbersModel> retVal = new List<AcceptCaseNumbersModel>();

        TokenModel tm = new TokenModel();
        tm = await TokenController.GetAccessToken();

        if (tm.access_token.Length > 0)
        {
            using (HttpClient client = DataAccess.EstablishConnection(ConfigurationManager.AppSettings.Get("ServiceUri"), ConfigurationManager.AppSettings.Get("ServiceReturnType")))
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tm.access_token);

                HttpResponseMessage response = new HttpResponseMessage();
                response = await client.GetAsync("api/GetAllAcceptCaseNumbers/" + candidateCases);

                if (response.IsSuccessStatusCode)
                    retVal = await response.Content.ReadAsAsync<List<AcceptCaseNumbersModel>>();
            }
        }
        return retVal;
    }
    #endregion
}

AnswerRe: How do I solve error StatusCode: 500? Pin
Richard Deeming30-Jan-20 4:10
mveRichard Deeming30-Jan-20 4:10 
GeneralRe: How do I solve error StatusCode: 500? Pin
Member 1140330430-Jan-20 4:44
Member 1140330430-Jan-20 4:44 
QuestionHTTP Error 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid Pin
simpledeveloper29-Jan-20 12:09
simpledeveloper29-Jan-20 12:09 
AnswerRe: HTTP Error 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid Pin
Richard Deeming30-Jan-20 1:06
mveRichard Deeming30-Jan-20 1:06 
GeneralRe: HTTP Error 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid Pin
simpledeveloper30-Jan-20 14:28
simpledeveloper30-Jan-20 14:28 
Question(SOLVED) Any ideas why gridview is not getting populated with data from the database? Pin
samflex29-Jan-20 9:30
samflex29-Jan-20 9:30 
SuggestionRe: Any ideas why gridview is not getting populated with data from the database? Pin
Richard Deeming30-Jan-20 1:02
mveRichard Deeming30-Jan-20 1:02 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 3:58
samflex30-Jan-20 3:58 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
Richard Deeming30-Jan-20 4:05
mveRichard Deeming30-Jan-20 4:05 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 4:20
samflex30-Jan-20 4:20 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
Richard Deeming30-Jan-20 4:53
mveRichard Deeming30-Jan-20 4:53 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 5:14
samflex30-Jan-20 5:14 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 5:41
samflex30-Jan-20 5:41 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
Richard Deeming30-Jan-20 5:47
mveRichard Deeming30-Jan-20 5:47 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 6:45
samflex30-Jan-20 6:45 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
Richard Deeming30-Jan-20 7:08
mveRichard Deeming30-Jan-20 7:08 
GeneralRe: Any ideas why gridview is not getting populated with data from the database? Pin
samflex30-Jan-20 8:11
samflex30-Jan-20 8:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.