Search Results

Search found 3 results on 1 pages for 'weevie'.

Page 1/1 | 1 

  • ASP.Net partially ignoring my Custom error section in web.config

    - by weevie
    Here's my web.config customErrors section (you'll notice I've switched the mode to 'On' so I can see the redirect on my localhost): <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On" redirectMode="ResponseRewrite"> <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" /> </customErrors> and here's the code that throws: Catch adEx As AccessDeniedException Throw New HttpException(DirectCast(HttpStatusCode.Forbidden, Integer), adEx.Message) End Try and here's what I end up with: Which is not my pretty AccessDenied.aspx page but it is a forbidden error page so at least I know my throw is working. I've removed the entry for 403 in IIS (7.0) as a desperate last attempt and unsuprisingly that made no difference. I've run out of ideas now so any suggestions will be gratefully appreciated!

    Read the article

  • Is there a way to transfrom a list of key/value pairs into a data transfer object

    - by weevie
    ...apart from the obvious looping through the list and a dirty great case statement! I've turned over a few Linq queries in my head but nothing seems to get anywhere close. Here's the an example DTO if it helps: class ClientCompany { public string Title { get; private set; } public string Forenames { get; private set; } public string Surname { get; private set; } public string EmailAddress { get; private set; } public string TelephoneNumber { get; private set; } public string AlternativeTelephoneNumber { get; private set; } public string Address1 { get; private set; } public string Address2 { get; private set; } public string TownOrDistrict { get; private set; } public string CountyOrState { get; private set; } public string PostCode { get; private set; } } We have no control over the fact that we're getting the data in as KV pairs, I'm afraid.

    Read the article

  • Not getting redirection to custom error page using custom errors - ASP.Net

    - by weevie
    Here's my Application_OnError event sink in global.asax.vb: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException)) Dim fourOhThree As Integer = DirectCast(HttpStatusCode.Forbidden, Integer) Throw New HttpException(fourOhThree, innerMostException.Message, innerMostException) End If End Sub You'll see that if we've got an innermost Exception of type AccessDeniedException we throw a new HTTPExcpetion with a status code of 403 AKA 'forbidden' Here's the relevant web.config entry: <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On"> <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" /> </customErrors> So what we're expecting is a redirect to the AccessDenied.aspx page. What we get is a redirect to the ServerError.aspx page. We've also tried this: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException)) Context.Response.StatusCode = DirectCast(HttpStatusCode.Forbidden, Integer) End If End Sub Which unsuprisingly doesn't work either. Any ideas what we're doing wrong?

    Read the article

1