Click here to Skip to main content
14,735,998 members
Home » Discussions » Web Development

Web Development

GeneralRe: ASP.Net Web API Deployment Not Working Pin
Kevin Marois29-May-19 8:42
professionalKevin Marois29-May-19 8:42 
GeneralRe: ASP.Net Web API Deployment Not Working Pin
Richard Deeming29-May-19 8:53
mveRichard Deeming29-May-19 8:53 
GeneralRe: ASP.Net Web API Deployment Not Working Pin
Kevin Marois29-May-19 9:12
professionalKevin Marois29-May-19 9:12 
QuestionPhoto Collage in Bootstrap...possible? Pin
Member 1208020129-May-19 7:05
MemberMember 1208020129-May-19 7:05 
AnswerRe: Photo Collage in Bootstrap...possible? Pin
Pete O'Hanlon29-May-19 23:04
mvePete O'Hanlon29-May-19 23:04 
QuestionHandling Web Request Failures Pin
Kevin Marois22-May-19 6:28
professionalKevin Marois22-May-19 6:28 
AnswerRe: Handling Web Request Failures Pin
Nathan Minier22-May-19 7:02
professionalNathan Minier22-May-19 7:02 
QuestionRestSharp Response Question Pin
Kevin Marois20-May-19 14:30
professionalKevin Marois20-May-19 14:30 
For testing, I purposely returned Forbidden in one of my API controller methods:
return request.CreateResponse(HttpStatusCode.Forbidden, "Not authorized");
I have a RestSharp wrapper class that has an Execute method:
public async Task<T> ExecuteAsync<T>() where T : new()
    URL = client.BaseUrl + request.Resource;

    IRestResponse<T> restResponse = await client.ExecuteTaskAsync<T>(request, new CancellationToken());

    var result = (T)restResponse.Data;

    if (!string.IsNullOrEmpty(restResponse.ErrorMessage))
        throw new Exception(restResponse.ErrorMessage);
        if ((int)restResponse.StatusCode >= 299)
            string message = $"An error occured...", {restResponse.StatusCode}, {restResponse.Content}";
            throw new Exception(message);

    return result;
The problem is that when an error occurs and restResponse.ErrorMessage has a message, it's something like
Unable to cast object of type 'System.String' to type 'System.Collections.Generic.IDictionary`2[System.String,System.Object]'.
and the restReponse.Content has the "Not authorized" message sent from the controller.

This seems odd. Shouldn't the exception message be the message I sent back? Am I doing something wrong here?

If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: RestSharp Response Question Pin
Richard Deeming21-May-19 1:49
mveRichard Deeming21-May-19 1:49 
QuestionAuthentication/Authorisation Pin
Mycroft Holmes16-May-19 13:47
professionalMycroft Holmes16-May-19 13:47 
AnswerRe: Authentication/Authorisation Pin
Richard Deeming17-May-19 2:03
mveRichard Deeming17-May-19 2:03 
GeneralRe: Authentication/Authorisation Pin
Mycroft Holmes17-May-19 13:44
professionalMycroft Holmes17-May-19 13:44 
QuestionQuestion about empty button top positioning. Pin
neodeaths11-May-19 13:39
Memberneodeaths11-May-19 13:39 
AnswerRe: Question about empty button top positioning. Pin
Richard Deeming13-May-19 9:09
mveRichard Deeming13-May-19 9:09 
QuestionWeb API Not Working Pin
Kevin Marois10-May-19 11:57
professionalKevin Marois10-May-19 11:57 
AnswerRe: Web API Not Working Pin
Richard Deeming10-May-19 12:12
mveRichard Deeming10-May-19 12:12 
GeneralMessage Closed Pin
17-May-19 0:01
Memberavrora malkova17-May-19 0:01 
QuestionNeed Some Of Your Help Pin
Member 143595087-May-19 22:12
MemberMember 143595087-May-19 22:12 
QuestionMVC5 Load partial view on link click Pin
#realJSOP4-May-19 7:52
mva#realJSOP4-May-19 7:52 
AnswerRe: MVC5 Load partial view on link click Pin
jkirkerx5-May-19 14:53
professionaljkirkerx5-May-19 14:53 
GeneralRe: MVC5 Load partial view on link click Pin
#realJSOP6-May-19 2:38
mva#realJSOP6-May-19 2:38 
GeneralMessage Closed Pin
14-May-19 9:43
Membermalkovich198814-May-19 9:43 
AnswerRe: MVC5 Load partial view on link click Pin
Richard Deeming8-May-19 2:31
mveRichard Deeming8-May-19 2:31 
Questiononline distance learning management system Pin
Sibanda Benon30-Apr-19 21:42
MemberSibanda Benon30-Apr-19 21:42 
AnswerRe: online distance learning management system Pin
Kevin Marois2-May-19 11:12
professionalKevin Marois2-May-19 11:12 

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.