How to open XML file in a new Browser Window in VB.NET?

I have a page which opens the diffredt uploaded docs(.doc,.xls,.xml,.csv etc) from Server.

Now i want to open this docs from my application.. . i can open .doc, .xlx, .jpg etc. .. but i cant open .xml.
How do i open the .xml file from m y application.

right now i use  Shell("file:\\../shared/" & strpath & "/" & CStr(docname) & ext)

but it gives me an error  "file not found", but fiel is there in same folder.

Regards
Nitesha
RedshelfAsked:
Who is Participating?
 
RedshelfAuthor Commented:
Solved ...there was some extra / in the path ..so thats whya it was not opening the doc. but learn a lot from this thread.

Nitesha
0
 
Alfred A.Commented:
Hi,

You can use a Web Browser Control and then use WebBrowser1.Navigate method to open the XML file.
0
 
Alfred A.Commented:
Just additional comment from my previous post, you can use Navigate method to use a physical path something like

WebBrowser1.Navigate("WebBrowser1.Navigate("C:\YourFile.xml"))
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
RedshelfAuthor Commented:
how do i add Web Browser control in my projetc. I have added Microsoft Web Browser COM component from tools ..but i can not see it in my tool box. where i  can find it?
0
 
Alfred A.Commented:
What is the version of Visual Studio you are using VS2005 or VS2008?
0
 
RedshelfAuthor Commented:
VS2008
0
 
Alfred A.Commented:
OK.  Under "All Windows Forms" tab, the last control in there should be "WebBrowser"
0
 
RedshelfAuthor Commented:
i cant find "All Windows Forms.

I ahve only, Standart,data,validation,navigation,login.webparts,AJAX extensions,reporting, html and general in my tool box.

where i can find "All Windows Forms"  tab ?
0
 
RedshelfAuthor Commented:
Is there any way i can create and use it  using  code behind..?
0
 
Alfred A.Commented:
Can you please clarify?  Are you doing an ASP.NET (Web application) Project or VB.NET (Windows Application) project?
0
 
Alfred A.Commented:
If you are using ASP.NET, check this out.  It can help.

http://support.microsoft.com/kb/315906
0
 
RedshelfAuthor Commented:
I have  managed to open XML file into new window using following code on button click.

 str = "<script type='text/javascript'>detailedresults=window.open('" & "../shared/" & strpath & "/test.xml" & "'" & "," & docname & " );</script>"
 ClientScript.RegisterStartupScript(Me.GetType(), "AvisoScript", str)

but i have a another problem now..
if strpath is like "\cat1\cat2" then it removes  back slash ( \ ) from the path. so it tries to open cat1cat2/test.xml. so i receive the error File not found.
 it should be cat/cat2/test.xml.  

Do you ahve any idea why it remove \ from strpath strin varible which stores the part of the path .

i have .aspx page and .aspx.vb page for my code behind.

Nitesha
0
 
Alfred A.Commented:
OK.  Use Server.MapPath to get the actual path for example.

Dim path As String = Server.MapPath("Images/blueWave.JPG")
Dim path As String = Server.MapPath("../Images/blueWave.JPG")
Dim path As String = Server.MapPath("~/Images/blueWave.JPG")

0
 
Alfred A.Commented:
Here is more information about Server.MapPath

http://msdn.microsoft.com/en-us/library/ms524632%28VS.90%29.aspx
0
 
RedshelfAuthor Commented:
thansk
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.