I'm Poor
I'm Poor

Reputation: 123

How can I run code withous the 'Page' object?

I need to send some data to the browser. In webforms obviously you can use Response.Write();

Is there any way I can do this if I don't have an aspx Default webform? Say I wanted to send the string "<p>Hello World</p>" to the browser without a webform, how would I do that?

Upvotes: 0

Views: 48

Answers (2)

devio
devio

Reputation: 37225

In ASP.Net, you can register a Http Handler derived from IHttpHandler in web.config.

You might also consider switching to ASP.Net MVC, where Pages are replaced by Controllers and Views.

Upvotes: 1

Anders Abel
Anders Abel

Reputation: 69300

Look at ASP.NET Web API, it is built for data APIs without pages.

Upvotes: 0

Related Questions