Click here to Skip to main content
15,908,013 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi friends i am publish one website in that having one image button when i am click on button it has to goto some url page..

example: when i am click on image button it has goto http://www.google.com



but it was shows error like this :
C#
Invalid path for child request 'http://www.google.com'. A virtual path is expected.


please help me ..it's urgent...

What I have tried:

my code is :
C#
protected void imgbtn_Click(object sender, ImageClickEventArgs e)
   {
        Server.Transfer ("http://www.google.com");
   }
Posted
Updated 18-Feb-16 21:49pm
Comments
F-ES Sitecore 19-Feb-16 4:32am    
If it's that urgent then learn to use google. Your question is incredibly basic and easily solved by searching.

1 solution

Server.Transfer is transfer to another link on the server. You should try
Response.Redirect(link).

But better solution would be (assuming you have no other processing done before redirect) to create anchor element containing the image with href pointing to your target site. That way you have no server round trip, just default behaviour of the link.
 
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