Hi Prasad,
it all depends on what type of RESPONSE you send to user. The response includes some header details on type of data being sent and the data itself, the browser then, reads the information an takes action accordingly.
For example:
Dim stream As New MemoryStream
document.Save(stream, False)
Response.Clear()
Response.ContentType = "application/excel"
Response.AddHeader("content-length", stream.Length.ToString())
Response.BinaryWrite(stream.ToArray())
Response.Flush()
stream.Close()
Response.End()
The above code says the data being passed is type of excel application. then browser asks the OS for application like excel or if any extension is given the browser asks for the application with which extension is registered and open it in that application.
So you need to send proper header information with data for what you want to achieve.
try adding following statement:
Response.AppendHeader("Content-Disposition", "inline;filename=" + "ExcelFile.xls")
If you have a working example like google, you can check what exactly google is sending to your browser to open the file. You can use
Fiddler to see what all requests the browser is sending for google and what is the response it is getting. The same settings you can use for your purpose.
Hope this will help.
Thanks,