How To Authenticate An HTTP Request To Remote Server That Can Be Utilize On End User Browser
Jul 26, 2010
There is one page which is actually a streaming to The Axis IP camera which spits MJPEG output.It requires user to log in with the user name/password promp on browser .I am using this stream to show video directly on a web page.It shows video correctly but asks user to provide correct user name and password set for the camera,I tried to logging in to this camera on server side using HTTP requests and then I realized I authenticated server request not the browser the end user is using.
So what I want is a method server side or client side, that can allow me to log-in to camera automatically when my end-users visit this page.I am using asp.net with c# 2005
To prevent duplicate requests (i.e. pressing F5 right after clicking a command button), I've setup my page base class to ignore the request if it's detected as a duplicate.
When I say 'ignore' I mean Response.End()
Now I thought I've seen this work before, where there's an issue, I just Response.End() and the users page just does nothing. I don't know the exact circumstance in which this worked, but I'm unable to repeat it now.
Now when I call Response.End(), I just get an empty browser. More specifically, I get this html.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD> <BODY></BODY></HTML>
I setup the following test app to confirm the problem is not elsewhere in my app. Here it is:
When you load the page, clicking any button does what is expected, but if you press F5 at any time after pressing one of the buttons, it will detect it as a duplicate request and call Response.End() which promptly ends the task. Which leaves the user with an empty browser.
Is there anyway to leave the user with the page as it was, so they can just click a button?
Also; please note that this code is the simplest code I could come up with to demonstrate my problem. It's not meant to demonstrate how to check for dup requests.
EDIT: Another change that will allow me to achieve the same results would be to disable all my event handlers.
I am calling a remote service and authenticating using a certificate. When testing with a Console App, everything works fine. When calling from an ASP.NET Website (.NET 4.0, IIS7) I receive a response code of 401 -- Unauthorized.I am adding the certificate using code such as:
var client = new TheGeneratedProxy(); client.ClientCertificates.Add(new X509Certificate("D:cert.pfx", "myPassword"));
(NOTE: I have also loaded the .pfx into the local Certificate Store using IE. The certificate is loaded into my "Personal" store -- so I suspect this to be the problem, since the Website will be running under a different account.)
I'm using a custom ashx handler to handle a file upload. When run locally, the file uploads fine.When I use the same setup on the web server I get a "Index out of range" error.In firebug I see the binary contents of the file in the post data and the file name is also passed in the query string.Any one seen this before?I`m sure its something minor, but its driving me up the wall.
Request header: Key Value Request POST /Secured/UploadHandler.ashx? HTTP/1.1 Accept text/html, application/xhtml+xml, */* Referer http://cms.webstreet.co.il/Secured/fileUpload.aspx Accept-Language he-IL User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) Content-Type multipart/form-data; boundary=---------------------------7db13b13d1b12 Accept-Encoding gzip, deflate [code]...
I'm trying to develop a Web application that sends requests it recieves to another server. Basically, my application will work like a proxy sending requests and responses to client and real server. I'm using HttpHandlers to capture all requests coming to server and using a class implemented from IHttpHandler, I create another request to my target server.
So far, I tried:
[Code]....
which got me the first page I request, for example when I request login page, I see it, but I can't see css or images(basically because it writes css and image files to page with context.Response.Write) also, since I did not get server variables I can not log in to my server, I keep reloading login page when I click login button.Then I tried changing the Host header of the first request I got thinking I could do a request with same request headers.
[Code]....
And got the error saying "Operation is not supported on this platform".
I have an ASP.NET project (VS2008 on Windows 7 with either webforms, MVC1, or MVC2 -- all the same result for me) which is just the File->New hello world web project. It's using the default ASP.NET development server, and when I start the server with F5, the browser never connects and I get a timeout. I tried to debug this by telnetting to the development server's port while it was running, and I got the same result:
C:Usersfarmercs>telnet localhost 54752 Connecting To localhost...Could not open connection to the host, on port 54752: Connect failed I can see in the system tray that the server thinks it's running, and a netstat -a -n command shows that there is indeed an active TCP listener on that port.
This worked in the not-too-distant past, and I could work on web projects using the development server. One thing that has changed since then was that I installed the Microsoft Loopback Adapter to accommodate a local development Oracle installation. I'm not sure this is the problem, but it seems a likely culprit.
I also tried to hit the port using the server name itself (http://mycomputername:54752) but with the same result. So, what could be blocking me from connecting? And if it's the loopback, then what is a good way for me to retain my ability to connect to my development Oracle server while still being able to use the ASP.NET development server?
I have a website I'm trying to catch up to speed on. It is throwing a null exception when the code tries to assign a variable pulled from a SqlDataSource query. The query is below:
[code]....
I want to know if there is a way to test the connection to the remote IP Address perhaps through some debugging tools and as a general question how would the web app authenticate against the remote database? I just see the connection string but no user name etc.
I am currently writing a C# web service which has several methods, one of which has to receive HTTP POST requests. The first thing i have done is alter the web.config file in the web service project as below.
[code]....
But when i run this i get "The remote server returned an error: (500) Internal Server Error". If i remove the parameter, by removing the stringbuilder and byte code, as well as having no parameter in the web service, it works. So it is obviously a problem with the parameters. I actually want to send more data, and was using a string[] parameter in the web service, but this also failed.
When I use WatiN to go to a specific web page, how can I fake the HTTP referrer with a query string (i.e. request is from google search with query string q=search_term)? So I can verify that the response header has the 301 redirect for specific referrer URL.
i redirect a page from http to https using http module begin request handler .i am calling webservice using ajax but it is saying webserice not defined .which otherwise works fineits work fine when rediect page in page_load instead .but i need to add function for https to http in every page. i still not know why ajax is not working when i use http module for redirect
I created aMicrosoft.Reporting.WinForms.ReportViewer with a window application. It worked fine when I was in net A with domain A. My application is now moved to net B with domain B. However when I login to my computer I still login netA with domain A, userID and password for A. I then use a A/B switch to switch to net B to run my application running ReportViewer (no login directly to B). But when I run ReportViewer I got errors like below.
The request failed with HTTP status 401: Unauthorized.
I have a webservice which works 100% fine on my developer machine. Where Web Service is installed on LOCALHOST on my developer machine,Then i went to my servers, I installed webservice on one server and map it with the server where the website is hosted, Then i tried accessing this service using BROWSER from my web server, it worked fine, That means the mapping was done perfect.Then i run my program on web server (website). It worked fine on page1, then on page2, but when i did the same and call same function on page3, It popped me any error of
I there a way to know if a request is a soap request on AuthenticateRequest event for HttpApplication? Checking ServerVariables["HTTP_SOAPACTION"] seems to not be working all the time.
public void Init(HttpApplication context) { context.AuthenticateRequest += new EventHandler(AuthenticateRequest); } protected void AuthenticateRequest(object sender, EventArgs e) { app = sender as HttpApplication; if (app.Request.ServerVariables["HTTP_SOAPACTION"] != null) { // a few requests do not enter here, but my webservice class still executing // ... } } I have disabled HTTP POST and HTTP GET for webservices in my web.config file. <webServices> <protocols> <remove name="HttpGet" /> <remove name="HttpPost" /> <add name="AnyHttpSoap" /> </protocols> </webServices> Looking at ContentType for soap+xml only partially solves my problem. For example, Cache-Control: no-cache Connection: Keep-Alive Content-Length: 1131 Content-Type: text/xml Accept: */* Accept-Encoding: gzip, deflate Accept-Language: ro Host: localhost mymethod: urn:[URL]
Some clients instead of having the standard header SOAPAction: [URL], have someting like in example above. "mymethod" represents the method in my web service class with [WebMethod] attribute on it and [URL] is the namespace of the webservice. Still the service works perfectly normal. The consumers use different frameworks (NuSOAP from PHP, .NET, Java, etc).
I develop an asmx web service (i.e. ASP.NET 2.0). There's a piece of code that may read the contents of the HTTP request (via HttpContext.Current.Request.InputStream) while processing it. I realise that InputStream may only be read once for a request, and I make sure I never try to read it more than once.
The problem seems to be that if InputStream happens to be read during the early stages of the application's lifecycle (e.g. after pskill w3wp, during Application_Start), the HTTP request fails with a HTTP 400 - Bad Request error, with no explanation given, no exception thrown and no entry in the httperr log. If it is read later (e.g. within the web method itself), requests run fine whether InputStream is read or not. Application_Start runs fine if InputStream isn't read.
Is this some sort of ASP.NET bug? IIS bug? Or am I doing something wrong by daring to read InputStream? And if so, is there another way to get a look at the "raw" contents of the request without disturbing the inner workings of IIS/ASP.NET? In short, adding this code within Application_Start is enough to reproduce this error: using (StreamReader reader = new StreamReader(HttpContext.Current.Request.InputStream))reader.ReadToEnd();
I am working on an app where users are only allowed access if they click through from certain URLs. I.e. I need to authenticate by using the referral url and I am using Request.UrlReferrer to achieve this.
I am guessing that the Request.UrlReferrer can be tampered with by malicious users to gain access...
using oAuth.net library for the Gmail Contacts API The request seems well-formed and I have stepped through the requests, and cannot discern anything wrong. Tried checking if the timestamp is an issue - it seems that was a common issue on the gmail forums, tried changing to various time-zones, still no luck.
I have a web application that authenticates against AD. On the first login attemt it takes roughly 30 seconds to login. On subsequent requests the login occurs almost immediatly. I've searched all over google and this forums and noticed several people with the problem and everyone seems to have a different solution of which none work for me.
I'm still new to windows authentication. Basically, we have a page on http://externalsite.com that needs to be accessed only by an authenticated user originating from http://internalsite. The user on internalsite is already authenticated using windows authentication.I'm confused here. How can I validate the user and obtain their role so that i can not only validate that they are authentic, but to authorize them to use this page on externalsite.com?
Can I get who the remote user is on IIS Server that is not part of the domain without challenging/prompting the user? I am thinking not, but wanted to see if anyone had a different answer. I added the server to my intranet zone but that didn't cause IE to send any user information. Or maybe it did but since the IIS server is not part of that domain it can't do anything with the user information. I am looking at the ServerVariables in the Request object.
I have a remote website form which sends variables to a page of my asp website. This is a standard form with http post. How do I access the url which sent the request to the page? Is this an environment variable? Http_referrer?