httphandler

What is “The parameterized query … which was not supplied.” error?

给你一囗甜甜゛ 提交于 2019-12-11 05:04:44
问题 I have experienced an error on "The parametrized query '(@blue nvarchar(4000))SELECT blueBallImage FROM CorrespondingBal' expects the parameter '@blue', which was not supplied." I am doing a HttpHandler. I want to retrieve the image from the database. My codes are as below. public void ProcessRequest (HttpContext context) { string image = context.Request.QueryString["image"]; SqlConnection con = new SqlConnection(@"Data Source=localhost;Initial Catalog=MyCloudGames;Integrated Security=True");

Httphandler for WebDav requests

好久不见. 提交于 2019-12-11 04:24:16
问题 I am trying to write a asp.net httphandler for handling webdav requests with IIS. I am extending the IHttpHandler interface and implementing the ProcessRequest. public class clsMyHandler : IHttpHandler { public void ProcessRequest(System.Web.HttpContext context) { StreamWriter sw = new StreamWriter(@"C:\requestLog.txt",true); sw.WriteLine("Got a request at " + DateTime.Now.ToString()); sw.Close(); } public bool IsReusable { get { return true; } } } It's a simple handler for my test purpose to

User.Identity.IsAuthenticated use in generic asp.net handler

[亡魂溺海] 提交于 2019-12-11 03:50:45
问题 I've set up an STS with WIF and want to expose whether a user is signed in so that an RP can determine if the user is signed in without requiring the user to redirect to the STS and return. If the user is signed in, a different process flow will occur on the RP so it's important to know but not to force the sign-in at this point in the process. My plan was to create a simple generic handler on the STS which, when hit via an HttpWebRequest, returns the output of context.User.Identity

Preserve Session Variables Across HttpHandlers

时光怂恿深爱的人放手 提交于 2019-12-11 01:44:53
问题 I have an ASP.NET application with 5 .ashx HTTPHandlers that implement IRequiresSessionState or IReadOnlySessionState. Upon calling the first handler I create a variable and store it in the session. When I call the next HttpHandler the variable is not available in the session object. I am use context.Session. I have a global.asax where I retrieve the sessionId. Is there a way to preserve session variables across HttpHandlers or does each Handler get its own session? 回答1: HeartAttack has a

TypeError: _this.handler.handle is not a function error

瘦欲@ 提交于 2019-12-11 01:01:17
问题 I am getting this error that this.handler.handle is not a function in my unit testing in Angular 6 using karma/jasmine. This error comes up in my command line when I type the 'ng test' command in my project folder. Chrome 67.0.3396 (Windows 10.0.0) AppComponent should create FAILED Failed: _this.handler.handle is not a function TypeError: _this.handler.handle is not a function for a test that should create AppComponent here is my .spec file import { async, ComponentFixture, TestBed } from '

How to check if an image exists in an image control with a handler to display the image

こ雲淡風輕ζ 提交于 2019-12-11 00:06:46
问题 Handler public class Handler2 : IHttpHandler { public void ProcessRequest(HttpContext context) { string id = context.Request.QueryString["Id"]; string constr = System.Configuration.ConfigurationManager .ConnectionStrings["EmployeeDatabase"].ConnectionString; SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand("GetImage", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@EmpID", id); //cmd.Parameters.AddWithValue("@Gender"

How do I restrict POST access to a HttpHandler?

妖精的绣舞 提交于 2019-12-10 23:47:02
问题 I have a few http handlers ( IHttpHandler ) in my asp.net web project. Now I want to restrict access to these handlers. For Handler1 I want to allow only POST requests, and for Handler2 I want to allow only GET requests. In my web.config I modified the <httpHandlers> section as shown below, but both handlers still process all verb types. Is there something I've missed? I'm testing it using IIS Express. <httpHandlers> <add verb="POST" path="Handler1.ashx" type="MyNamesapce.Handler1, MyAssembly

HttpHandler in IIS7 and Visual Studio 2010

荒凉一梦 提交于 2019-12-10 19:38:26
问题 I'm trying to run an httphandler (ashx) in a asp.net 4 website. When I call it from Visual Studio integrated server, it returns a 404 error. It works if I call it on the site configured into the local IIS. Someone could help? 回答1: Are you using ASP.NET MVC, or System.Web.Routing? Do you have something like routes.IgnoreRoute("{resource}.ashx/{*pathInfo}"); in your RegisterRoutes() function in your HttpApplication instance? One thing to keep in mind is that the Visual Studio server thingie

Why are there two web.config files in my MVC application

风格不统一 提交于 2019-12-10 16:58:06
问题 There is one in the Views folder. And there is another in the root of the app. I want to register a custom handler and i cant understand where the code should go. I'm running IIS7 in Integrated Mode so I have to add a <handlers> tag to the <system.webServer> but when I'm looking at the web.config at the Views folder I see that it uses a <httpHandlers> under <system.web> tag. So two questions: 1. why are there two web.config files in an mvc application? 2. where and in what way I should

User Session ID as a Parameter in an Ajax Call

南笙酒味 提交于 2019-12-10 16:47:59
问题 I have created an HttpHandler that I will be using with a jquery-Ajax call. This HttpHandler will access the database and check something related to the currently singed in user . The user is considered signed in by using the Session, with an attribute called user_id . Session["user_id"] = userId; I tried to retrieve this Session in the HttpHandler but that doesn't seem to work. So I thought about sending the user_id as a parameter . var user_id = //Retrieved in some way... $.ajax({ url: