Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 387103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:38:27+00:00 2026-05-12T15:38:27+00:00

I’m about to start working on a ClickOnce app targeted at internal customers for

  • 0

I’m about to start working on a ClickOnce app targeted at internal customers for use on the organization’s intranet. I want to ease the setup process, so I thought that developing the app to be partially trusted would be a good idea, but now I’m not so sure.

One thing that the users have specifically asked for is (boiled down to) a TextBox with Cue Text. The easiest way to provide this at the moment is with a simple subclass of TextBox that includes the CueText functionality as a property. The cuetext functionality is done via a PInvoke’d call to SendMessage().

protected override void OnHandleCreated(EventArgs e)
{
    this.UpdateCueText();  // Bang, you're dead here
    base.OnHandleCreated(e);
}

private void UpdateCueText()
{
    if (this.IsHandleCreated)
    {
        NativeMethods.SendMessage(new HandleRef(this, this.Handle), setCueBannerMessage, this.showCueTextWithFocus ? new IntPtr(1) : IntPtr.Zero, this.cueText);
    }
}

“Ah-ha! I need SecurityPermission.UnmanagedCode.” The default intranet zone security includes the SecurityPermission permission as far as I can tell, so I try running it and it explodes on the call to UpdateCueText(). I can even inspect the properties on the SecurityException b/c every attempt to evaluate a SecurityException property throws another uninspectable SecurityException.

I try the standard modification:

protected override void OnHandleCreated(EventArgs e)
{
    var permission = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
    permission.Assert();
    try
    {
        this.UpdateCue();
    }
    finally
    {
        CodeAccessPermission.RevertAssert();
    }
    base.OnHandleCreated(e);
}

Still no luck. But when I go to the security settings page in the project properties and set the SecurityPermission to be “Included” instead of “Zone Default”, I don’t even need the manual assertion, everything just happens. But of course, then I assume the customer is still going to get an elevation prompt.

Is it possible to do what I’m trying to do from a partial trust environment? I’m beginning to suspect that it’s not b/c it wouldn’t even make sense. Arbitrary partially-trusted code shouldn’t be able to just call SendMessage, right? I’m beginning to realize that I’ve been trying to circumvent the security measures instead of work within them.

If that’s the case, is it even worth the effort to develop this app with partial trust as a priority? Or should I just resign myself to an elevation prompt on setup to create a fully trusted app for the sake of schedule and meeting ui requirements?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:38:27+00:00Added an answer on May 12, 2026 at 3:38 pm

    The statement

    permission.Assert();
    

    can only grant your thread permissions that are already available to the assembly. That’s why that doesn’t work.

    So: Yes, you’ll need to include those permissions at the assembly level. And like JaredPar says, you might as well use full-trust.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.