Is it possible to create an asp.net generic handler (.ashx)

Answered

Hi,

Is it possible to create an asp.net generic handler in Rider? And if how to do it.

 

Best,
Nikolaj

2 comments
Comment actions Permalink

Hi! 
Thanks for the feedback.

I have added an issue to add file template. https://youtrack.jetbrains.com/issue/RIDER-9679

For now only manual adding files and content is possible.

1. Add->New->File "YourName.ashx"
1.1 Paste code inside

<%@ WebHandler Language="C#" CodeBehind="Handler1.ashx.cs" Class="WebApplication2.Handler1" %>


2. Add->New->File "YourName.ashx.cs"
2.1. Paste code inside

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication2
{
/// <summary>
/// Summary description for Handler1
/// </summary>
public class Handler1 : IHttpHandler
{

public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}

public bool IsReusable
{
get
{
return false;
}
}
}
}

3. Edit csproj via pressing F4 on project in Solution explorer
3.1. Change

<Compile Include="Handler1.ashx.cs" />

to

<Compile Include="Handler1.ashx.cs">
<DependentUpon>Handler1.ashx</DependentUpon>
</Compile>

 

1
Avatar
Permanently deleted user
Comment actions Permalink

Thanks Ivan,
Hope to ser the template type in Rider in the near future.

/Nikolaj

0

Please sign in to leave a comment.