Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi..............
I want open my web page programmatically in different browsers using asp.net i.e web pages open in mozila,chrome depends on user input.I want to this functionality in asp.net.provide soln for it.

Thanx in advance
Posted

System.Diagnostics.Process proc = new System.Diagnostics.Process();
If(ur condition for firefox)
{
proc.StartInfo.FileName = "firefox";
}
else if(ur condition for ie)
{
proc.StartInfo.FileName = "iexplore";
}
else if(ur condition for chrome)
{
proc.StartInfo.FileName = "chrome";
}

and so on.....

proc.StartInfo.Arguments = "www.google.com";
proc.Start();
 
Share this answer
 
Comments
Ranjith Reddy CSE 2-Jun-12 5:45am    
where should we write this Code...in which page ?
Vijay Walunj,Navi mumbai 2-Jun-12 7:47am    
currently i am write this code on button click event.Actually i want to this code in pageload of my starting page of web application
Vijay Walunj,Navi mumbai 2-Jun-12 7:36am    
thanx yar.this solution works at my pc.but i have one more problem that when i am running this app locally works properly but when hosting it doesn't gave any error but my browser not display .actually in task manager i had seen that browser exe process run but browser not seen to me.if the process user is my self then it display but if it asp.net not seen.How to resolve this prob.i want host my site provide soln for it.thanx
Just right click on the page on Visual Studio, choose browse with and then select the browser of your choice.
 
Share this answer
 
Hello My Dear Friend !!

Go to Solution Explorer,(Ctrl+Alt+S)

Right Click on Your Project name -> Click on Browse with -> select the browser from list -> Set as Default.

if you want, you can set the size of the browser window from list.


Thanks.
 
Share this answer
 
Comments
Ranjith Reddy CSE 2-Jun-12 3:50am    
Sorry, Shortcut for solution Explorer is Ctrl + Alt + L

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