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 608267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:26:40+00:00 2026-05-13T17:26:40+00:00

We have some ASP.NET stuff (it’s not delineated clearly enough to call it a

  • 0

We have some ASP.NET stuff (it’s not delineated clearly enough to call it a component), that we’d like to clean up, and wrap some boundaries around, so that we can reuse it. There are really four parts to this, some markup, some C# code-behind, some javascript running in the browser, and a webservice method that is called by the javascript.

One way of cleaning this up would be to move the markup into a user control, the C# into the code-behind methods of the user control, the javascript into a file that would be included in the page by the code-behind method, and the webservice into a static method in the code-behind. (Assuming, of course, that I can flag a static method in a User Control as a WebMethod and have it work, which I’ve not tried yet.)

In any case, the above won’t work for us, because we want to create a component that we can include in multiple projects. And that means we want a component we can include in a DLL, and that means a Server Control, instead of a User Control.

A Server Control, of course, means no markup. The html needs to be injected into the page by the C#. That’s not a problem, we’ve done that before. Including the javascript as a resource, and having the Server Control insert it into the page doesn’t seem too difficult. I’ve not done it, yet, but I see plenty of examples on how to, so I’m sure I will be able to figure it out.

But the part of this I’m not sure I understand, yet, is the webservice. This control will include javascript that will make calls back to a webservice. The webservice will communicate only with the Server Control, but it will need to talk to the same database that the Web Application that is including the Server Control is talking to. That is, this isn’t a situation where we can configure a single, stand-alone webservice that all instances of the Server Control will talk to, we need a separate webservice included in each Web Application that includes the Server Control.

The thing is, that since the Server Control is included in a DLL, we’d like for the code for this webservice to also be included in the DLL. Right now, all I can think of is to define a class within the DLL that does all the work that the webservice needs to, that can then be called by a webservice that we define in the Web Application. But I’m not really happy with that. In my ideal world, simply including the Server Control in the Web Application would automatically include and configure the webservice that it needs to talk to. But I don’t know how to do that, and I’m not sure that it is possible.

So what I’m looking for are possibilities as to how close I could get to that, within ASP.NET 3.5.

Ideas?

  • 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-13T17:26:41+00:00Added an answer on May 13, 2026 at 5:26 pm

    To my knowledge, there’s no way to completely encapsulate the server-side endpoint within a server control. It’s something I’ve wrestled with in the past without a completely satisfactory solution.

    Probably the cleanest, most idiomatic .NET solution is to use an HttpHandler for the server-side endpoint. The consuming application will require a one-line web.config addition, but no additional files need be created.

    Take a look at how ASP.NET AJAX implements ScriptResource.axd for a good, concrete example of this approach. Source code for that: http://www.microsoft.com/downloads/details.aspx?FamilyId=EF2C1ACC-051A-4FE6-AD72-F3BED8623B43&displaylang=en

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

Sidebar

Related Questions

No related questions found

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.