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

  • SEARCH
  • Home
  • 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 5991909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:21+00:00 2026-05-22T23:27:21+00:00

I am writing an series of web interfaces to some data. I have WebMethods

  • 0

I am writing an series of web interfaces to some data. I have WebMethods to return the data in DataSet and XmlDataDocument format (The XmlDataDocument removes all the schema overhead.)

[WebMethod]
public XmlDataDocument Search_XML( string query ) {
  return new XmlDataDocument( Search_DataSet( query ) );
}
[WebMethod]
public DataSet Search_DataSet( string query ) {
  DataSet result = new DataSet( "SearchResults" );
  //... Populate DataSet here
  return result;
}

I have also created a function that accepts an XSL formatting string and returns the formated results, allowing the client to format an HTML response they can inject right into their webpage:

public string Search_XSL( string query, string xsl ) {
  string result = "";
  XmlDataDocument resultxml = Search_XML( query );
  XslCompiledTransform transform = new XslCompiledTransform();
  using ( StringReader xslstringreader = new StringReader( xsl ) ) {
    using ( XmlReader xslxmlreader = XmlReader.Create( xslstringreader ) ) {
      using ( MemoryStream transformedmemorystream = new MemoryStream() ) {
        using ( StreamWriter transformedstreamwriter = new StreamWriter( transformedmemorystream ) ) {
          try {
            transform.Load( xslxmlreader );
            transform.Transform( resultxml, null, transformedstreamwriter );
            transformedstreamwriter.Flush();
            transformedmemorystream.Position = 0;
            using ( StreamReader transformedreader = new StreamReader( transformedmemorystream ) ) {
              result = transformedreader.ReadToEnd();
            }
          }
          catch ( Exception ex ) {
            result = ex.InnerException.ToString();
          }
        }
      }
    }
  }
  return result;

}

My question is, how do I implement a WebMethod-like interface for this Search_XSL() function so that I can return the resulting string exactly as the function does, without the XML encoding the WebMethod puts around it? Would that be a new Web Form? How do I implement a Web Form with no actual HTML, just accepting form parameters? Not sure where to start here.

Edit: It looks like a “Generic Handler” .ashx file is the way to go. Is this the right approach?

  • 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-22T23:27:22+00:00Added an answer on May 22, 2026 at 11:27 pm

    If you need an HTTP endpoint that processes an HttpContext and returns a custom response, then using IHttpHandler via a Generic Web handler (*.ashx) would be the correct approach to take.

    You would read the values from the request query string and then process the request. Your generic handler would use the HttpContext.Response to set the content type of the output stream to text/html and would write the resulting HTML you wish to inject.

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

Sidebar

Related Questions

Writing a small HTML web page with some very simple Javascript in it, I
I'm writing a series of Windows services. I want them to fail if errors
I'm writing a tool to run a series of integration tests on my product.
Writing some test scripts in IronPython, I want to verify whether a window is
Writing the code for the user authentication portion of a web site (including account
I have a series of urls tied to Django's generic date views. In the
Been writing some raw SQL queries after noticing how inefficient some of Django's built-in
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
Writing my first Linq application, and I'm trying to find the best way to

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.