<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Filter to find active Sessions form ASP.NET Apps xxxx in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Filter-to-find-active-Sessions-form-ASP-NET-Apps-xxxx/m-p/143069#M29230</link>
    <description>&lt;P&gt;Try this and and it's working well.&lt;/P&gt;

&lt;P&gt;You can access session state using a custom RouteHandler.&lt;/P&gt;

&lt;P&gt;// In global.asax&lt;BR /&gt;
public class MvcApp : System.Web.HttpApplication&lt;BR /&gt;
{&lt;BR /&gt;
    public static void RegisterRoutes(RouteCollection routes)&lt;BR /&gt;
    {&lt;BR /&gt;
        var route = routes.MapHttpRoute(&lt;BR /&gt;
            name: "DefaultApi",&lt;BR /&gt;
            routeTemplate: "api/{controller}/{id}",&lt;BR /&gt;
            defaults: new { id = RouteParameter.Optional }&lt;BR /&gt;
        );&lt;BR /&gt;
        route.RouteHandler = new MyHttpControllerRouteHandler();&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;// Create two new classes&lt;BR /&gt;
public class MyHttpControllerHandler&lt;BR /&gt;
    : HttpControllerHandler, IRequiresSessionState&lt;BR /&gt;
{&lt;BR /&gt;
    public MyHttpControllerHandler(RouteData routeData) : base(routeData)&lt;BR /&gt;
    { }&lt;BR /&gt;
}&lt;BR /&gt;
public class MyHttpControllerRouteHandler : HttpControllerRouteHandler&lt;BR /&gt;
{&lt;BR /&gt;
    protected override IHttpHandler GetHttpHandler(&lt;BR /&gt;
        RequestContext requestContext)&lt;BR /&gt;
    {&lt;BR /&gt;
        return new MyHttpControllerHandler(requestContext.RouteData);&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;// Now Session is visible in your Web API&lt;BR /&gt;
public class ValuesController : ApiController&lt;BR /&gt;
{&lt;BR /&gt;
    public string Get(string input)&lt;BR /&gt;
    {&lt;BR /&gt;
        var session = HttpContext.Current.Session;&lt;BR /&gt;
        if (session != null)&lt;BR /&gt;
        {&lt;BR /&gt;
            if (session["Time"] == null)&lt;BR /&gt;
                session["Time"] = DateTime.Now;&lt;BR /&gt;
            return "Session Time: " + session["Time"] + input;&lt;BR /&gt;
        }&lt;BR /&gt;
        return "Session is not availabe" + input;&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;Read more here&lt;BR /&gt;
&lt;A href="http://markfreedman.com/handling-session-and-authentication-timeouts-in-asp-net-mvc/"&gt;http://markfreedman.com/handling-session-and-authentication-timeouts-in-asp-net-mvc/&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://keenesystems.com/Expertise/ASPNetWebApplications.aspx"&gt;http://keenesystems.com/Expertise/ASPNetWebApplications.aspx&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.asp.net/get-started"&gt;http://www.asp.net/get-started&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Dec 2015 13:18:56 GMT</pubDate>
    <dc:creator>emmawatson009</dc:creator>
    <dc:date>2015-12-17T13:18:56Z</dc:date>
    <item>
      <title>Filter to find active Sessions form ASP.NET Apps xxxx</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filter-to-find-active-Sessions-form-ASP-NET-Apps-xxxx/m-p/143068#M29229</link>
      <description>&lt;P&gt;Hi, I'm a new Splunk User.&lt;BR /&gt;
I have a big problem. &lt;BR /&gt;
I'll try to find out, how many active Sessions are open from ASP.NET Apps xxxx?&lt;BR /&gt;
How and where can I build this filter?&lt;BR /&gt;
I can`t  find some answers in the documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2015 10:58:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filter-to-find-active-Sessions-form-ASP-NET-Apps-xxxx/m-p/143068#M29229</guid>
      <dc:creator>rpardon</dc:creator>
      <dc:date>2015-02-12T10:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Filter to find active Sessions form ASP.NET Apps xxxx</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Filter-to-find-active-Sessions-form-ASP-NET-Apps-xxxx/m-p/143069#M29230</link>
      <description>&lt;P&gt;Try this and and it's working well.&lt;/P&gt;

&lt;P&gt;You can access session state using a custom RouteHandler.&lt;/P&gt;

&lt;P&gt;// In global.asax&lt;BR /&gt;
public class MvcApp : System.Web.HttpApplication&lt;BR /&gt;
{&lt;BR /&gt;
    public static void RegisterRoutes(RouteCollection routes)&lt;BR /&gt;
    {&lt;BR /&gt;
        var route = routes.MapHttpRoute(&lt;BR /&gt;
            name: "DefaultApi",&lt;BR /&gt;
            routeTemplate: "api/{controller}/{id}",&lt;BR /&gt;
            defaults: new { id = RouteParameter.Optional }&lt;BR /&gt;
        );&lt;BR /&gt;
        route.RouteHandler = new MyHttpControllerRouteHandler();&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;// Create two new classes&lt;BR /&gt;
public class MyHttpControllerHandler&lt;BR /&gt;
    : HttpControllerHandler, IRequiresSessionState&lt;BR /&gt;
{&lt;BR /&gt;
    public MyHttpControllerHandler(RouteData routeData) : base(routeData)&lt;BR /&gt;
    { }&lt;BR /&gt;
}&lt;BR /&gt;
public class MyHttpControllerRouteHandler : HttpControllerRouteHandler&lt;BR /&gt;
{&lt;BR /&gt;
    protected override IHttpHandler GetHttpHandler(&lt;BR /&gt;
        RequestContext requestContext)&lt;BR /&gt;
    {&lt;BR /&gt;
        return new MyHttpControllerHandler(requestContext.RouteData);&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;// Now Session is visible in your Web API&lt;BR /&gt;
public class ValuesController : ApiController&lt;BR /&gt;
{&lt;BR /&gt;
    public string Get(string input)&lt;BR /&gt;
    {&lt;BR /&gt;
        var session = HttpContext.Current.Session;&lt;BR /&gt;
        if (session != null)&lt;BR /&gt;
        {&lt;BR /&gt;
            if (session["Time"] == null)&lt;BR /&gt;
                session["Time"] = DateTime.Now;&lt;BR /&gt;
            return "Session Time: " + session["Time"] + input;&lt;BR /&gt;
        }&lt;BR /&gt;
        return "Session is not availabe" + input;&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;Read more here&lt;BR /&gt;
&lt;A href="http://markfreedman.com/handling-session-and-authentication-timeouts-in-asp-net-mvc/"&gt;http://markfreedman.com/handling-session-and-authentication-timeouts-in-asp-net-mvc/&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://keenesystems.com/Expertise/ASPNetWebApplications.aspx"&gt;http://keenesystems.com/Expertise/ASPNetWebApplications.aspx&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www.asp.net/get-started"&gt;http://www.asp.net/get-started&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 13:18:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Filter-to-find-active-Sessions-form-ASP-NET-Apps-xxxx/m-p/143069#M29230</guid>
      <dc:creator>emmawatson009</dc:creator>
      <dc:date>2015-12-17T13:18:56Z</dc:date>
    </item>
  </channel>
</rss>

