Reputation: 38495
Is there any way to set the Parameter
property from web.config?
public class TestHttpHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public string Parameter
{ get; set; }
public void ProcessRequest(HttpContext context)
{
context.Response.Write(Parameter);
}
}
If i do the following it just crashes.
<handlers>
<add name="Test" verb="*" path="/Manual/*"
type="Test.TestHttpHandler, Test" Parameter="test1234 "/>
</handlers>
Upvotes: 0
Views: 351
Reputation: 11222
Parameter
is not a valid attribute for the handlers/add
note. Just adding a property with the same name to your handler class doesn't make it magically work.
You can not pass a parameter directly in the handler definition, but within the code of your handler class you have full access to any other configuration data in web.config; any AppSetting or your own ConfigSections.
Upvotes: 1