Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created web browser control in winforms. I have a web page that opens a popup on click of a link button. The popup window page uses Request.urlreferrer.pathandquery. When i am opening the popup through ie (IE8) the page is loaded successfully and the urlreferrer is not null. But when i try opening the page using the web browser control i created i am getting the url referrer as null and the page shows null reference exception error.

Can anyone please suggest me what to do with respect to the web browser control. Thanks in advance.

Note:- I do not have the privileges to cahgne the code of the popup page. And i need to do something in the web browser control only.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Nov-13 23:20pm    
"privileges to cahgne..."... what is "cahgne"? How did you open this page in both cases, in more detail?
—SA
Krishna Kumar 2-Dec-13 4:30am    
"privileges to change" actually. I opened the page in ie and the browser control in the same way.
Typing the url in the address box. The popup is opened on click of a hyperlink through javascript
Sergey Alexandrovich Kryukov 2-Dec-13 9:38am    
Thank you for clarification. Then in both cases there is no a referral.
—SA

1 solution

You don't need to change the page, of course. Null referral is actually the legitimate situation. All your problem is the understanding of the purpose of the referral.

A referral gets certain value if you click on the element with URI (most usually, the anchor element with href attribute) which cause another page to load. In this case, HTTP request goes with the referral referencing the page where you clicked on the link. As you simply typed URL in the address box of the browser, you don't have a referral ("you come on the requested page from nowhere").

Of course, to avoid the null reference exception, you should check for null before dereferencing of the referral property. Not only for referral, but for all members or variables of reference types which can potentially be null.

—SA
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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