http-headers

Request Web Page in c# spoofing the Host

I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request for a page before the ...

Why is the Internet Explorer Autocomplete feature disabled for all html forms on my website?

When Internet Explorers AutoComplete is turned on for Forms the entries for each field in the HTML form should be cached and displayed as a prompt when the user starts entering content into the form the second time around. On my website the AutoComplete feature is never displayed for any forms that exist on that site. But yet other w...

Problem with caching

I have an a aspx page, but all content is generated by hands(yes I know that I need to make a handler, I have another question) I want to cache output in client browser. Problem is that it's cached only for one query. public static void ProceedCaching(string etag, string lastModify, string response, HttpResponse Response, ...

WCF Service in ASP.NET Compat Mode - What is the Simplest Way to Pass Username/Password

I have a web service (WCF or ASMX doesn't matter)... I have made a Console application, right-clicked, added service referrence. So far, so good. However, I cannot for the life of me pass "security" credentials across to my service. This is my client code: var client = new MyClient(); client.ClientCredentials.UserName.UserName = "bob"...

Can I change the headers of the HTTP request send by the browser?

I'm looking into a restful design and would like to use the HTTP methods (POST, GET, ...) and HTTP headers as much as possible. I already found out that the HTTP methods PUT and DELETE are not supported from the browser. Now I'm looking to get different representations of the same resource and would like to do this by changing the Accep...

Is there anyway to change the content type of an XML document, in the XML document?

Is there anyway to change the content-type of an XML document, in the XML document? I'm working with a really old system that passes back HTML (and we are trying to make it return XML). I'm retrieving it from XMLHttpRequest, and I noticed using netcat that it isn't passing back any content-type headers. When I receive the XMLHttpRe...

Can you write a 301 redirect to an anchor point?

Is this valid and correct? RewriteRule ^myOldPage.html$ /index.php#info [R] I'm specifically interested about the #info part. ...

Help with mod_rewrite and Joomla

On my Joomla site, I've added some fairly straight-forward RewriteRules to my .htaccess file. They're all one-to-one rules like this, since I'm changing the file structure of the site and don't want to break my old links. RewriteRule ^content/view/54/48/$ /courses [R] These are in addition to the existing rules that come packaged with...

HTTP Headers for File Downloads

I've written a PHP script that handles file downloads, determining which file is being requested and setting the proper HTTP headers to trigger the browser to actually download the file (rather than displaying it in the browser). I now have a problem where some users have reported certain files being identified incorrectly (so regardles...

Get Client IP using just Javascript?

I need to somehow pull the clients IP address using pure javascript, no server side code, not even SSI. Any ideas? I'm not against using a free 3rd party script, if someone can suggest one. This is an emergency stop gap until we can deploy new code. ...

Grails File Download

Hi there, I'm trying to craete a site which allows users to upload any file type they like. I've implemented this feature fine, and the file is held on the server. Later on they can download the file to view, but i'm having trouble getting it to work. I've used any examples I can get hold of but they all tend to use text files as examp...

How to use the CSV MIME-type ?

In a web application I am working on, the user can click on a link to a csv file. There is no header set for the mime-type, so the browser just renders it as text. I would like for this file to be sent as a .csv file, so the user can directly open it with calc, excel, gnumeric, etc. header('Content-Type: text/csv'); echo ...

Easy way to test a URL for 404 in PHP?

I'm teaching myself some basic scraping and I've found that sometimes the URL's that I feed into my code return 404, which gums up all the rest of my code. So I need a test at the top of the code to check if the URL returns 404 or not. This would seem like a pretty straightfoward task, but Google's not giving me any answers. I worry I...

What is the correct response to an HTTP POST request?

For a POST method, the W3 specs say: If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see Section 10.4). http://www.ietf.org/internet-drafts/draft-ietf-httpbi...

Pushing Headers and AJAX

Hello all, I have a script that forces a download and I make a call to this via Javascript. However, the dialog box doesn't pop up, here is the download.php script: header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // ...

Hyperlink works - Html Form with a Submit button doesn't

I have a PHP script that pushes the headers to allow a file to download. This script works fine when it called via a hyperlink or through the browser using link. This is how it looks like: <a href="download.php?file=test.mp3&properFilename=Testing File">Download</a> I want this to be a button (sbumit) instead, so I did this: <form ac...

How to add cookie on a HttpTransportBindingElement

I'm having a WCF client which communicates with a WCF service (running AspNetCompabilityMode), and I would like to add a cookie (on the client) to every call to this web service. I have looked at the HttpTransportBindingElement, but I cannot find where to add my cookie - is it possible to add a cookie to the HttpTransportBindingElement,...

Do search engines respect the HTTP header field “Content-Location”?

I was wondering if search engines respect the HTTP header field Content-Location. This could be useful e.g. when you want to remove the session id argument out of the URL: GET /foo/bar?sid=0123456789 HTTP/1.1 Host: example.com … HTTP/1.1 200 OK Content-Location: http://example.com/foo/bar … Clarification: I dont’t want to redirect...

HttpWebRequest Cookie weirdness

I'm sure I must be doing something wrong. But can't for the life of me figure out what is going on. I have a problem where it seems that the HttpWebRequest class in the framework is not correctly parsing the cookies from a web response. I'm using Fiddler to see what is going on and after making a request, the headers of the response lo...

What is the purpose of the HTTP header field “Content-Location”?

Confused/inspired by a comment to my question Do search engines respect the HTTP header field “Content-Location”?, I’d like to know, what the exact purpose of the Content-Location header field in HTTP is and how it can be used. ...