C# - How To Simulate Http Request Using WatiN With Specific HTTP Referrer And Query String

Dec 6, 2010

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.

View 2 Replies


Similar Messages:

HttpHandlers / Modules :: Redirect A Page From Http To Https Using Http Module Begin Request Handler?

Jul 15, 2010

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

View 3 Replies

Forms - Simulate HTTP POST Programmatically?

Feb 23, 2011

I need to simulate an HTTP POST programatically, i.e., I need to generate a Request with some POST variables and then send it to a page. To clarify, I need to simulate the behaviour of a regular POST, not do the whole thing programatically. So basically I need to fill in a Request in the same way it would be filled if a form POST was happening, and then send the browser to the page that expects the POST.

View 4 Replies

WCF / ASMX :: Request Failed With HTTP Status 400: Bad Request Accessing Web Service

May 15, 2010

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

View 4 Replies

Determine If A HTTP Request Is A Soap Request On HttpApplication.AuthenticateRequest

Jan 21, 2010

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).

View 4 Replies

First Request Fails With HTTP 400 (Bad Request) After Reading HttpRequest.InputStream

Oct 24, 2010

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();

View 1 Replies

Emulate Specific HTTP Headers?

Oct 5, 2010

I Have a specific set of HTTP response headers I'm trying to recreate in ASP.NET.
Here is how it looks in Fiddler (Raw):

HTTP/1.1 200 OK
Content-Length: 570746
Content-Type: audio/wav
Last-Modified: Wed, 19 May 2010 00:44:38 GMT
Accept-Ranges: bytes
ETag: "379d676ecf6ca1:3178"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 05 Oct 2010 18:35:18 GMT

Here is how it looks on the Headers tab (same data. Different view)

I am trying to recreate the same set of headers (different values of course) with code, on an ASP.NET page. The biggest problem is with the cache settings and the ETag. It usually shows some "private" or similar cache setting and no ETag value, even though I'm trying to set it explicitly with

Response.Cache.SetETag

View 1 Replies

Web Forms :: Redirecting To A Page At Server / Error Is Http 500 Or Http 403

Dec 2, 2010

I am having problem redirecting error when error is http 500 or http 403 locally running this site there is no problem it gets redirected to my errorpage.aspx. But when deployed at server, it does not get .tried putting try and catch in page_load and in global.asax and I have set Application_Error to redirect to that page and also set <customErrors defaultRedirect to that page also

error
statusCode="500"
redirect="/errors/errorpage.aspx?error=500"
/>

View 9 Replies

How To Hunt Down HTTP Request

Feb 25, 2010

It uses asp.net (webforms), bunch of jquery plugins and whatnot.

Problem: there's unnecessary HTTP request to localhost/undefined and that makes every request take ~1s longer than needed.

Question: is there any tactic to find guilty code?

Clue: undefined makes me think that there's JS involved.

Firebug log:

GET /undefined HTTP/1.1
Host: localhost:17817
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; lv; rv:1.9.2) Gecko/20100115
Firefox/3.6
Accept: image/png,image/;q=0.8,/*;q=0.5
Accept-Language: lv,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-13,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost:17817/Default.aspx

if you right click a line in the code, it gives you a conditional breakpoint. Check the name of the variable that has the URL value, and set a condition when typeof URL === 'undefined' or url === 'undefined' and look at the stack

Just set breakproint at line 3400 (with no conditions). It does not go through there.

3397 ajax: function( s ) {
3398 // Extend the settings, but re-extend 's' so that it can be
3399 // checked again later (in the test suite, specifically)
3400 s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));

Narrowed issue down a bit => commented out 1 ascx controller that renders some images and uses gallerific jquery plugin and magic request dissapeared.

Problem was with galleriffic plugin initialization. It couldn't find anchor and it's href for creating thumbnails when there were no images or something. It's cool now...

View 3 Replies

C# - Http Request Issue In Asp.Net

Jul 24, 2010

I am using C# + VSTS 2008 + .Net 3.5 + ASP.Net + IIS 7.0 + ADO.Net + SQL Server 2008. I want to develop an ASP.Net aspx page which has the following function,

1 It could accept 3 Url parameters param1, param2 and param3, and the request looks like this,

http://mysite.com/foo.aspx?parame1=abc¶m2=def¶m3=ghi

2 When the page is responsed to client browser, I want to display a text input and a submit button nearby in the result html page, and value of text input is the same as param1, in this sample, abc will be displayed in text box, in the browser address bar, I want to keep the original long url http://mysite.com/foo.aspx?parame1=abc¶m2=def¶m3=ghi;

3 When the user change the value in text input, and click submit button, I want to send this request again to foo.aspx, and changing the param1 value to the value which user entered in text input, and at the same time, keep values of parame2 and param3 the same as last request's response. For example, when user requests http://mysite.com/foo.aspx?parame1=abc¶m2=def¶m3=ghi, and the page displays, when user changes text input from abc to google, the new request will be http://mysite.com/foo.aspx?parame1=google¶m2=def¶m3=ghi

Any reference samples? My question is I do not know how to implement so many functions in one aspx page.

View 1 Replies

Generating HTTP Request?

Aug 21, 2010

In how many ways can an HTTP request be generated?

View 2 Replies

Get MAC Address From HTTP Request

Jul 22, 2010

picking up the Users MAC address from the HTTP request.

The users will be from OUTSIDE my network.

View 3 Replies

HTTP Response And Request In Binary

Feb 21, 2010

I need to I can make the web request to a webservice which take a XML argument. And is expected to return a Binary response. I am able to make the request but while recieving the response back I am unable to get the response in binary. When I read the response
using streamreader see the header and some attached "HEBRISH" words probably binary but unable to sepreate it out. Please help in seprating out the binary the response data.

View 1 Replies

MVC :: Handle Dates In Mvc When Request Is A Http GET?

May 10, 2010

how do u handle dates in mvc when request is a http GET? I remember some discussoin on this last year but cant find the posts.. things like culture unaware, splitting the date field to 3 text fields insted of 1.

View 6 Replies

How To Edit HTTP Request With Fiddler

Aug 5, 2010

Is it possible to edit HTTP request using fiddler so that my asp.net application hosted elsewhere return true for the following code block

HttpContext.Current.Request.Url.Host == "localhost"

View 1 Replies

Why Parameters Are Encoded When Sent Through HTTP Request

Feb 17, 2011

I am curious to know the reasons why the HTTP request encodes(URLEncoded) all the parameters before sending it across the network in POST request.

View 1 Replies

Making Http Request From Code Behind

Mar 3, 2011

I am trying to implement Message API

I am not sure how I will be calling this from code-behind and in their snippet it says:

https://platform.3cinteractive.com/api/send_message.php

POST
username=aRDSe3vcaMzh06YrMcxcQw==&password=1BSvQc6lpNlnp4ufWgRLPHNJ7RMrL8CcaWCzL1Vtw+Y=&phone_number=+11234567890&trigger_id=1105&message=howdy

View 2 Replies

MVC :: IIS Responding With 404 On HTTP HEAD Request?

Jul 28, 2010

I'm currently trying to setup testing with Selenium. It seems that Selenium sends a HEAD request to my route /Home/Index before it sends the GET request. This causes all my tests to fail. I was wondering how I would go about getting HEAD requests to respond correctly (not 404).

View 3 Replies

Load Images With Http Request?

Nov 15, 2010

i have a usercontrol which displays 1 inage this control is used several times on my page. the problem i have some images can be large so i need to load them using http request i think, i want to display a loading image until the actual image is loaded, what would be the best way to do this?

View 2 Replies

Change HTTP Status 503 To 200 When Serving App_offline.htm For Specific URL?

Feb 22, 2011

The app_offline.htm file that ASP.NET serves returns the http status 503. This is the correct behavior for most situations. However, in the scenario where a specific URL is requested (e.g. [URL]), I'd like to change the returned http status to 200, while still returning http status 503 in all other situations. Is this possible?

The reason why I want to do this is whenever we do scheduled maintenance on our website, we use the app_offline.htm file, but we don't want our uptime monitoring service [URL] to report downtime during our scheduled maintenance.

I assume this would have to be at the IIS level because the app_offline.htm gets served very early on in the request processing cycle.

View 6 Replies

HTTP Requests In C# - Find A Specific Text Box In Webpage

Jan 20, 2010

I need to visit a URL, find a specific text box in said page - fill it with data and then submit a form.

How can I accomplish this in C#?

View 2 Replies

Code To Output A Specific HTTP Header E.g. X-adexpert-id?

Sep 10, 2010

What is the code to output a specific HTTP header e.g. x-adexpert-id

View 2 Replies

Read A HTTP Post Request With Some Data

Nov 9, 2010

I am using an Zencoder API to transcode video files. Once the job is completed they will do a HTTP POST with XML or JSON data containing the Job ID and other info to the url we provide.

So if URL is www.abc.com/GetZencoderResponse.aspx or .ashx, how can I read the data they post?

excuse me for the underlines, i thought that would make my query stand out.

View 6 Replies

Send A Plaintext Raw Http Post Request?

Jan 29, 2010

All I need is to send a http post request I pulled from fiddler.

I do not want to use HttpWebRequest class. It makes it hard to set up a request, does not allow to change host,

and when it does send it it looks nothing like the request I want. The server is very sensitive and unless I copy the request headers 100% it will return an empty page. Why can't I just type in the headers and send it that way? What would be 5 minutes of
work in php is taking the whole evening in asp.net.

This is what I am trying to send, simple as it gets: ...

View 9 Replies

Web Forms :: Request.UrlReferer Empty In Http

Dec 14, 2010

we know that we can access previous page url in asp.net by using Request.UrlReferer. So i also used this property to access prev page url in my web application. But my problem is that all works fine in http:// and problem starts when move web site in production server with https:// instead of http:// So can any one have idea what to do to get Request.UrlReferer in https:// ? problem occurs all the other browser not in IE ( problem in : Mozzila,Safari,Chrome....)

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved