Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way to identify whether incoming http request is coming because of
1 User Entered the specified Url
or
2. It was requested as part of html Document, say request for *.js file from document(page).
Posted
Updated 8-Oct-15 2:00am
v2
Comments
Krunal Rohit 8-Oct-15 8:06am    
if (HttpContext.Current.Request.HttpMethod == "GET")
{
//GET action
}

like this ?

-KR
scud.corsair 8-Oct-15 8:17am    
Off course we can do that,
but my question is how can we differentiate between GET request.

Say a separate GET request will be sent to "image.jpg" if it is referenced inside a web page.

Howeever we can also enter the complete Url of "image.jpg" , and it will be a GET request.

How can I differentiate between these two?
ZurdoDev 8-Oct-15 8:32am    
Reply to the comment so that the user is notified.
F-ES Sitecore 8-Oct-15 8:50am    
Look at the request's referrerurl. If you navigate direct to a url it will have no referrer, if the image has been embedded in a page the referrer will be the url of the parent page.
scud.corsair 8-Oct-15 9:19am    
mate , you saved my day

1 solution

No. There is no difference between the two requests that will tell you if a user typed the URL or not.

The only way you can tell that is if you added a parameter to the request string made by your HTML or javascript code, something that the user won't type.
 
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