Class Not Executing

Hi,

I have an event handler and it mostly works, but I added an insert calling to a class file.
the line does not execute, nor does it throw an error.

at this line
    //Add user
            Dal.InsertUser(8);
line: 24

if anyone know what I am doing wrong, would greatly appreciate it

below is the full code of the handler

<%@ WebHandler Language="C#" Class="AdHandler" %>

using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;

// Context = HttpContext.Current;

public class AdHandler : IHttpHandler
{
    DAL Dal = new DAL();
    public void ProcessRequest(HttpContext context)
    {

        string url = context.Request.QueryString["AdUrl"];

        try
        {


            //Add user
            Dal.InsertUser(8);
            
            //Add Hit
            AddHit(url);
            
           

        }

        catch
        {

        }

        finally
        {

            context.Response.Redirect(url);

        }

    }

    public int AddHit(string url)
    {

        SqlConnection con = new
SqlConnection(WebConfigurationManager.ConnectionStrings["SQLDbconn"].ConnectionString);

        con.Open();

        SqlCommand com = new SqlCommand("AddHit", con);

        com.CommandType = System.Data.CommandType.StoredProcedure;

        com.Parameters.Add(new SqlParameter("@url", url));

        int res = com.ExecuteNonQuery();

        con.Close();

        return res;

    }

    public bool IsReusable
    {

        get
        {

            return false;

        }

    }

}

Open in new window

TheWebGuy38Asked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
You wouldn't know if it were throwing an error since you are swallowing the exception with an empty catch statement. Aside from that, we probably won't be able to help you without seeing the definition of InsertUser.
0
 
TheWebGuy38Author Commented:
LOL... ok,,, I'm not blond. but somedays, I don't know.

I can't believe I just did that
0
 
TheWebGuy38Author Commented:
ok,, it's thowing an error with


context.session("")

I think I need to add something like

IRequiresSessionState  I'm not a C programmer but I think I had a similar problem before
0
 
käµfm³d 👽Connect With a Mentor Commented:
C# is case-sensitive. Try:

    context.Session["some_key"]
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.