Click here to Skip to main content
15,898,374 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to update database when adding an item Pin
Dave Kreskowiak12-Jul-15 6:26
mveDave Kreskowiak12-Jul-15 6:26 
GeneralRe: How to update database when adding an item Pin
Member 1183153312-Jul-15 7:00
Member 1183153312-Jul-15 7:00 
QuestionLinq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 4:54
professionalKevin Marois10-Jul-15 4:54 
AnswerRe: Linq-ToSql and EF Questions Pin
Richard Deeming10-Jul-15 5:54
mveRichard Deeming10-Jul-15 5:54 
GeneralRe: Linq-ToSql and EF Questions Pin
Kevin Marois10-Jul-15 5:56
professionalKevin Marois10-Jul-15 5:56 
Questionwifi form Pin
Member 118239158-Jul-15 16:51
Member 118239158-Jul-15 16:51 
AnswerRe: wifi form Pin
Dave Kreskowiak8-Jul-15 17:22
mveDave Kreskowiak8-Jul-15 17:22 
QuestionCasting HttpRequestMessage.Properties["MS_RequestContext"] to OwinHttpRequestContext Pin
Alaric_8-Jul-15 11:09
professionalAlaric_8-Jul-15 11:09 
So this is weird.
I'm trying to manually fiddle with a property of my MS_RequestContext during Controller Activation inside my WebApi's CompositionRoot.


my Create method receives a System.Net.Http.HttpRequestMessage argument.

I can drill down request to grab
C#
request.Properties["MS_RequestContext"]

Properties is a
dictionary<string,object>
That object will be an OwinHttpRequestContext at runtime.

But whenever I attempt to cast, so that I can access the properties on the RequestContext, I get a naughty-gram from Visual Studio
C#
(request.Properties["MS_RequestContext"] as OwinHttpRequestContext).Request.Properties;


The error that comes back is:
C#
The type or namespace 'OwinHttpRequestContext' could not be found (are you missing a using directive or an assembly reference?)


Well...OwinHttpRequestContext lives inside the System.Web.Http.Owin namespace. My references are all set up. I even have added a using statement for good measure.

So the crazy part is that if I remove my code that attempts to directly reference request.Properties, but instead set a breakpoint inside my Create method, I can -through a watch- execute

(request.Properties["MS_RequestContext"] as System.Web.Http.Owin.OwinHttpRequestContext).Request.Properties

without issue. I can confirm that I have no problem modifying the properties at runtime through the immediate window.

Why am I not able to perform this same cast at build time?

I've inspected the
HttpContext.Current.GetOwinContext()

for access to the property that I need to manipulate, but it's not available on IOwinContext.
"I need build Skynet. Plz send code"

QuestionSelectSingleNode issue Pin
tiwal7-Jul-15 7:42
tiwal7-Jul-15 7:42 
QuestionRe: SelectSingleNode issue Pin
ZurdoDev7-Jul-15 7:50
professionalZurdoDev7-Jul-15 7:50 
AnswerRe: SelectSingleNode issue Pin
tiwal7-Jul-15 8:25
tiwal7-Jul-15 8:25 
AnswerRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 8:36
mveRichard Deeming7-Jul-15 8:36 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:08
tiwal7-Jul-15 9:08 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 9:12
mveDave Kreskowiak7-Jul-15 9:12 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 9:40
tiwal7-Jul-15 9:40 
GeneralRe: SelectSingleNode issue Pin
Dave Kreskowiak7-Jul-15 10:02
mveDave Kreskowiak7-Jul-15 10:02 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 10:07
tiwal7-Jul-15 10:07 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 10:10
mveRichard Deeming7-Jul-15 10:10 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 10:21
tiwal7-Jul-15 10:21 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming7-Jul-15 11:26
mveRichard Deeming7-Jul-15 11:26 
GeneralRe: SelectSingleNode issue Pin
tiwal7-Jul-15 21:02
tiwal7-Jul-15 21:02 
GeneralRe: SelectSingleNode issue Pin
Richard Deeming8-Jul-15 1:26
mveRichard Deeming8-Jul-15 1:26 
AnswerRe: SelectSingleNode issue Pin
Pete O'Hanlon8-Jul-15 0:22
mvePete O'Hanlon8-Jul-15 0:22 
SuggestionRe: SelectSingleNode issue Pin
Richard Deeming8-Jul-15 1:29
mveRichard Deeming8-Jul-15 1:29 
GeneralRe: SelectSingleNode issue Pin
Pete O'Hanlon8-Jul-15 1:45
mvePete O'Hanlon8-Jul-15 1:45 

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.