Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello expert,

I have a website which is having a link. On clicking the link it creates the below httpRequest and redirects to MyWebsites.Below code is written on click of the link.

Httprequest req = new Httprequest();
req.setEndpoint('https://SERVWRIP/MyWebSite/');
req.setMethod('POST');
req.setHeader('latteOrgId', loi);
req.setHeader('open', requestedDocument);
req.setHeader('Content-Length',’0’);
req.setTimeOut(200);

Since MyWebSite is developed in Asp.NET and C# thus I need to read the http header parameter latteOrgId, open in default.aspx file of MyWebSite .
Posted
Updated 2-May-11 20:10pm
v3

Request.Headers[YOUR_KEY_NAME] will give you the header values.

Example:

C#
string latteOrgId = Request.Headers["latteOrgId"];


Mark it as answer if it is helpful
 
Share this answer
 
v2
Comments
Albin Abel 3-May-11 3:02am    
Oops, you win me. My 5
Member 4500014 3-May-11 3:06am    
still it gives me null value...
So, I am not sure where are you stuck up with. Reading the data?

If so,
Request.Forms["latteOrgId"] would have the data you are looking for.
 
Share this answer
 
Comments
Member 4500014 3-May-11 2:37am    
latteOrgId I already tried the below code but everytime i get null value in latteOrgId

NameValueCollection nvc = Request.Form;

if (!string.IsNullOrEmpty(nvc["latteOrgId"]))
{
latteOrgId = nvc["latteOrgId"];
}

if (!string.IsNullOrEmpty(nvc["open"]))
{
open = nvc["open"];
}

if (latteOrgId != null && open != null)
{

}
Hi

To get the header information at your target asp.net page use Request.Headers["latteOrgId"];.
 
Share this answer
 
Are you **sure** that this is a problem on the server side in extracting the value from the request - and that it could not be a client side problem in formulating / sending the request in the first place?

Have you tried looking at what actually goes over the wire with something like WireShark so that you can be 100% certain whether you need to be looking at the server side or client side code?

Have you also looked at the page life cycle and checked the state of things in its various stages - see http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]. If you've checked that this is a server side problem, handle and debug into page events to see what the HttpRequest object is actually giving you - are other (standard) headers / form variables visible? Where in the life cycle is your current code executing?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900