Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Compilation Error #102

Closed
whoiskevinrich opened this issue Feb 2, 2016 · 8 comments
Closed

Compilation Error #102

whoiskevinrich opened this issue Feb 2, 2016 · 8 comments

Comments

@whoiskevinrich
Copy link
Contributor

Following the instructions in the readme, I've added the following to my Startup.cs

    public class Startup
    {
        public readonly StuntmanOptions StuntmanOptions = new StuntmanOptions();

        public void Configuration(IAppBuilder app)
        {

            StuntmanOptions.AddUser(new StuntmanUser("ajoe")
                    .AddClaim("given_name", "Average")
                    .AddClaim("family_name", "Joe"));

            StuntmanOptions.SetUserPickerAlignment(StuntmanAlignment.Right);

            if (System.Web.HttpContext.Current.IsDebuggingEnabled)
            {
                app.UseStuntman(StuntmanOptions);
            }
        }
    }

and the following to my view:

@if (HttpContext.Current.IsDebuggingEnabled)
{
    @Html.Raw(Startup.StuntmanOptions.UserPicker(User))
}

However, I'm seeing "an object reference is required for the non-static field, method, or property 'Startup.StuntmanOptions'. Am I missing a step?

@kendaleiv
Copy link
Contributor

Missing a @using on the view? Try using the full namespaced call to the Startup class. See samples/UsageSampleMvc/Views/Shared/_Layout.cshtml#L38 for an example.

@whoiskevinrich
Copy link
Contributor Author

I did try adding the full namespace, to no avail. I appreciate the help, this project will be quite useful.

@kendaleiv
Copy link
Contributor

I don't see any obvious issues. You could clone down this repository and run the UsageSampleMvc to see if that works for you.

@whoiskevinrich
Copy link
Contributor Author

Looks like there is a minor difference between the usage sample and the
readme example. The code now compiles, I just need to figure out why my
Stuntman options are being ignore. I'm perfectly prepared for it to be a
Windows Auth issue of somekind. Thanks for the help!

On Tue, Feb 2, 2016 at 1:33 PM Ken Dale [email protected] wrote:

I don't see any obvious issues. You could clone down this repository and
run the UsageSampleMvc and see if that works for you.


Reply to this email directly or view it on GitHub
#102 (comment).

@kendaleiv
Copy link
Contributor

If there's an error in the README.md, do you happen to know exactly what it is so we could update it?

@whoiskevinrich
Copy link
Contributor Author

I added a pull request: #103

@kendaleiv
Copy link
Contributor

Thanks, #103 was merged. Good to close this issue?

@whoiskevinrich
Copy link
Contributor Author

Sounds good, thanks for the help. I haven't figured out how to create StuntmanUsers for Windows Auth, but this issue is good to go.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants