Click here to Skip to main content
15,886,518 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHTTP Error 500.19 - Internal Server Error Pin
indian14321-Jun-17 11:29
indian14321-Jun-17 11:29 
AnswerRe: HTTP Error 500.19 - Internal Server Error Pin
F-ES Sitecore21-Jun-17 22:41
professionalF-ES Sitecore21-Jun-17 22:41 
GeneralRe: HTTP Error 500.19 - Internal Server Error Pin
indian14322-Jun-17 7:38
indian14322-Jun-17 7:38 
AnswerRe: HTTP Error 500.19 - Internal Server Error Pin
Richard Deeming22-Jun-17 1:25
mveRichard Deeming22-Jun-17 1:25 
QuestionPosting the same form on 10 pages to a single action on a controller Pin
jkirkerx21-Jun-17 7:36
professionaljkirkerx21-Jun-17 7:36 
AnswerRe: Posting the same form on 10 pages to a single action on a controller Pin
Richard Deeming21-Jun-17 8:59
mveRichard Deeming21-Jun-17 8:59 
GeneralRe: Posting the same form on 10 pages to a single action on a controller Pin
jkirkerx22-Jun-17 12:56
professionaljkirkerx22-Jun-17 12:56 
QuestionMVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
jkirkerx19-Jun-17 11:29
professionaljkirkerx19-Jun-17 11:29 
I'm looking some examples of forcing HTTPS or force HTTP in attribute form for use in the controller.
I found The Westwind guy "Rick" example and gave it a shot and it works. But once it turns HTTPS on, it always on. I didn't see the point of it.

WestwindToolkit/RequireSslAttribute.cs at master · RickStrahl/WestwindToolkit · GitHub

I added the debug part, which works fine, and I'm testing in production mode.
I'm not interested in securing the entire program in HTTPS or SSL, but just parts of it.

My question is where or how would be a good way to go back to HTTP in the code example above?
public RequireSslAttribute(string appSettingsKey)
{
    string key = ConfigurationManager.AppSettings[appSettingsKey] as string;
    bool debugEnabled = HttpContext.Current.IsDebuggingEnabled;
    RequireSsl = false;
    if (!string.IsNullOrEmpty(key))
    {
        key = key.ToLower();
        if (key == "true" || key == "1")
            if (debugEnabled == false)
                RequireSsl = true;                

    }
}
If it ain't broke don't fix it

AnswerRe: MVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
Richard Deeming19-Jun-17 11:48
mveRichard Deeming19-Jun-17 11:48 
GeneralRe: MVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
jkirkerx19-Jun-17 12:22
professionaljkirkerx19-Jun-17 12:22 
GeneralRe: MVC controller attribute to select SSL for individual pages, manually select, force SSL off Pin
jkirkerx20-Jun-17 13:02
professionaljkirkerx20-Jun-17 13:02 
QuestionShould a REST API return exception in response body? Pin
Bastien Vandamme19-Jun-17 1:58
Bastien Vandamme19-Jun-17 1:58 
AnswerRe: Should a REST API return exception in response body? Pin
John C Rayan19-Jun-17 3:21
professionalJohn C Rayan19-Jun-17 3:21 
QuestionHow to save HTML Table to database Pin
Member 1053560718-Jun-17 9:24
Member 1053560718-Jun-17 9:24 
AnswerRe: How to save HTML Table to database Pin
User 418025418-Jun-17 14:45
User 418025418-Jun-17 14:45 
AnswerRe: How to save HTML Table to database Pin
John C Rayan19-Jun-17 3:23
professionalJohn C Rayan19-Jun-17 3:23 
QuestionHtml helper in c# mvc app Pin
e$heldon17-Jun-17 15:10
e$heldon17-Jun-17 15:10 
AnswerRe: Html helper in c# mvc app Pin
User 418025418-Jun-17 14:47
User 418025418-Jun-17 14:47 
GeneralRe: Html helper in c# mvc app Pin
e$heldon19-Jun-17 9:10
e$heldon19-Jun-17 9:10 
AnswerRe: Html helper in c# mvc app Pin
John C Rayan19-Jun-17 3:26
professionalJohn C Rayan19-Jun-17 3:26 
GeneralRe: Html helper in c# mvc app Pin
e$heldon19-Jun-17 9:13
e$heldon19-Jun-17 9:13 
QuestionCall Default View From Controller Pin
Kevin Marois16-Jun-17 7:57
professionalKevin Marois16-Jun-17 7:57 
AnswerRe: Call Default View From Controller Pin
Richard Deeming16-Jun-17 8:40
mveRichard Deeming16-Jun-17 8:40 
GeneralRe: Call Default View From Controller Pin
Kevin Marois16-Jun-17 9:14
professionalKevin Marois16-Jun-17 9:14 
GeneralRe: Call Default View From Controller Pin
Kevin Marois19-Jun-17 4:03
professionalKevin Marois19-Jun-17 4:03 

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.