|
Hi,
How do I get a browser within an aspx page? What I am trying to do is have my aspx page with all the html and within the html have a browser displaying a different website.
Is this possible? I am using Visual Studio 2005.
Many thanks
Paul
|
|
|
|
|
oceanexplorer,
Sounds like you are trying to host a web page inside of an existing webpage. It does not take ASP.NET to do this... Just an IFRAME tag:
MSDN: IFrame Object (Html Reference)
|
|
|
|
|
Hi All,
I am trying to get HTML of a page using COMStream. I am running following code.
Imports System
Imports System.Diagnostics
Imports System.Runtime
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.MarshalByRefObject
Imports System.IO
Imports System.ComponentModel
Imports mshtml
Imports SHDocVw
Public Class GetNukeSource
' IPersist interface
<ComVisible(True), ComImport(), Guid("0000010c-0000-0000-C000-000000000046"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IPersist
Sub GetClassID(ByRef pClassID As Guid)
End Interface
' IPersistStreamInit interface
<ComVisible(True), ComImport(), Guid("7FD52380-4E07-101B-AE2D-08002B2EC713"), _
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IPersistStreamInit : Inherits IPersist
Shadows Sub GetClassID(ByRef pClassID As Guid)
<PreserveSig()> Function IsDirty() As Integer
Sub Load(ByVal pstm As UCOMIStream)
Sub Save(ByVal pstm As UCOMIStream, _
<MarshalAs(UnmanagedType.Bool)> ByVal fClearDirty As Boolean)
Sub GetSizeMax(ByRef pcbSize As Long)
Sub InitNew()
End Interface
<DllImport("OLE32.DLL")> _
Private Shared Sub CreateStreamOnHGlobal(ByVal hGlobal As IntPtr, _
ByVal fDelete As Boolean, ByRef stm As UCOMIStream)
End Sub
<DllImport("OLE32.DLL")> _
Public Shared Sub GetHGlobalFromStream(ByVal stm As UCOMIStream, ByRef hGlobal As IntPtr)
' LEAVE THIS BLANK - PLACEHOLDER
End Sub
Dim iptr As IntPtr
Public Function getNukesource(ByVal pageUrl As String) As String
Dim strm As UCOMIStream
Dim ips As IPersistStreamInit
Dim ie As New SHDocVw.InternetExplorer
Dim objDocument As mshtml.IHTMLDocument2
Try
ie.Navigate(pageUrl)
ie.Visible = True
Do Until ie.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
Thread.Sleep(50)
Loop
Catch ex As Exception
Throw ex
Finally
End Try
Dim strRetPage As String
Try
ips = DirectCast(ie.Document, IPersistStreamInit)
Catch ex As Exception
Throw ex
End Try
If ips Is Nothing Then
strRetPage = Nothing
Else
strm = GetStream(2048)
End If
Try
ips.Save(strm, False)
If Not strm Is Nothing Then
strRetPage = Me.StreamToString(strm)
End If
ie.Quit()
Return strRetPage
Catch ex As Exception
Throw ex
End Try
End Function
Private Function GetDocumentSource(ByVal doc As mshtml.IHTMLDocument2, ByVal resetIsDirty As Boolean) As String
Dim stream As UCOMIStream
Dim ips As IPersistStreamInit
Dim s As String
Try
ips = DirectCast(doc, IPersistStreamInit)
If ips Is Nothing Then
s = Nothing
Else
stream = GetStream(2048)
' Save the document into the comstream, without clearing the
ips.Save(stream, False)
s = StreamToString(stream)
End If
Return s
Catch ex As Exception
Throw ex
End Try
End Function
Private Function StreamToString(ByVal strm As UCOMIStream) As String
Dim iptr As IntPtr
Dim s As String
Try
GetHGlobalFromStream(strm, iptr)
' If the source is the cloned and modified document then Auto must be used ***
s = Marshal.PtrToStringAnsi(iptr)
Return s
Catch ex As Exception
Throw ex
End Try
End Function
Private Function GetStream(ByVal size As Integer) As UCOMIStream
Dim iptr As IntPtr
Dim strm As UCOMIStream
Try
' Create a pointer to a block of the required size
iptr = Marshal.AllocHGlobal(size)
' Create the stream from the pointer
CreateStreamOnHGlobal(iptr, True, strm)
Return strm
Catch ex As Exception
Throw ex
End Try
End Function
End Class
This code sometimes runs fine and sometimes gives me following error.
An unhandled exception of type 'System.ExecutionEngineException' occured in translationservice.dll.
Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.
Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
After this error comes up CPU usage reaches to 100%.
I do not understand what is the problem with my code. I will appreciate if someone of you guys could help me about it.
Thanks,
Ahmad
|
|
|
|
|
Hi ,
please can you give me a link or something to download a free good video explain session state & application state
you know, how they work ?? & when we can use them & so on
thank you
try to be good if you can't be the best
|
|
|
|
|
Hi ,
i want to do a button in the page that close all the web site well i haven't seen that sh*t before but they demanded it in the exam what may i do ??
can you tell me the code i must write in the click event please ??
thank you
try to be good if you can't be the best
-- modified at 13:13 Sunday 25th June, 2006
|
|
|
|
|
Hi ,
well i have to build a small web site & i need in to do a text_changed event but it doesn't work , i know because client/server & somethings like that
i'm demanding the way , how can i make it work just like in vb.net ? i know it is not the same concept but i want it work
it worked with me but not the way i want it to work it works just when i leave the text box i will tell you
i want for each letter i type in the textbox1 to see this letter in label1 & like that
can you tell me how todo it ?
try to be good if you can't be the best
|
|
|
|
|
If you want it to work on each character typed, you must do it through DHTML and not ASP.NET. ASP.NET would require you resubmit the form (aka Postback) each time the user types something, which would be insanely slow for the poor user and would kill the resources of your server.
Try using the onKeyPress event found in the "input type=text" object. Within that event, update the label by setting it's innerHTML property.
|
|
|
|
|
hey sorry but i want to tell you , i heard abt somrthing called ajax it enables that stuff it allows you for each type of a caracter the label can receive it & also i heard that you can add some javascript i heard a lot of things but i don't know how to use them i searched a lot but you don't find somebody who can tell you the right thing to do
what is this propriety you told me innerHTML ?
try to be good if you can't be the best
|
|
|
|
|
Hi, seems logic but the HTML text doesn't fire a post back & even that i tried this idea but it doesn't work
look , for example i have a list of guests in my listbox & i want when i type something in a textbox over that list the guests that only the guests that have the name start whith these letters stay in the listbox
can you have any idea how can i do that please ??
try to be good if you can't be the best
|
|
|
|
|
plz help..I need a link flash swf..that enables downloading a file from server.
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
What are you wanting to do? Embed the swf in the webpage or download the swf?
If you want to embed the swf, just use the standard object/embed tags.
http://www.alistapart.com/articles/flashsatay/[^] details a method embedding swf using XHTML Strict.
If you are trying to download the swf, then will you need to change the mime-type of the swf to application/octet-stream
<%@ Page Language="VB" %>
<script Language="VB" Option="Explicit" runat="server">
Sub Page_Load(sender as Object,e as EventArgs)
Dim fileName as String="/test.swf";
Response.ContentType="application/octet-stream"
Response.AddHeader("Content-Disposition","filename="&fileName)
Response.WriteFile(Server.MapPath(fileName))
End Sub
</script>
|
|
|
|
|
Hi,
I have a very simple issue with my datagrid.
I have a date column only in datagrid. I have future dates, current dates and past dates in that.
I want to show the row selected which is nearest to today, when data load from dataset.This is one issue. Second, I want to change color of the row when somebody select a row. when somebody click another row, previously selected row's color will change to it's original color.
If anybody can help me, i will really appreciate that.
Thanks,
NIKI
|
|
|
|
|
Hi..
I have visual studio 2003 and I am trying to use Google Search Web Service(C#).But I got the error:
DataBinder.Eval: 'EProjects.googleapi.ResultElement' does not contain a property with the name title.
The source code of the Web Form that should display the Google Search Results:
using googleapi;
/// <summary>
/// Summary description for GoogleResults.
/// </summary>
public class GoogleResults : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.ImageButton imgPrev;
protected System.Web.UI.WebControls.ImageButton imgNext;
protected System.Web.UI.WebControls.DataList lGoogle;
public EProjects.googleapi.GoogleSearchResult gsR;
public EProjects.googleapi.GoogleSearchService gcs;
private void Page_Load(object sender, System.EventArgs e)
{
gcs=new googleapi.GoogleSearchService();
gsR=gcs.doGoogleSearch(licenceKeyString,Request.QueryString["Query"],
0, 1,true, "", true, "", "", "");
PopulatelGoogle(gsR);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
///Required method for Designer support - do not modify
///the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void PopulatelGoogle(GoogleSearchResult gsR)
{
lGoogle.DataSource=gsR.resultElements;
lGoogle.DataBind();
}
}
}
The HTML code of the same page:
<table height="100%" width="100%">
<tr>
<td colSpan="2">
<asp:datalist id="lGoogle" runat="server">
<ItemTemplate>
<span style="font-size:17px;font-weight:bold;">
<%#DataBinder.Eval(Container.DataItem,"title")%>
</span></br>
<%#DataBinder.Eval(Container.DataItem,"snipper")%>
</br> <a href='<%#DataBinder.Eval(Container.DataItem,"URL")%>'>
<%#DataBinder.Eval(Container.DataItem,"URL")%>
</a>
</ItemTemplate>
<SeparatorTemplate>
</p>
</SeparatorTemplate>
</asp:datalist></td>
</tr>
<tr>
<td align="left"><asp:imagebutton id="imgPrev" Runat="server"></asp:imagebutton></td>
<td align="right"><asp:imagebutton id="imgNext" Runat="server"></asp:imagebutton></td>
</tr>
</table>
I tried to solve this problem for a long time but I couldnt please help.
"I am too late but i will never give up"
|
|
|
|
|
hello
i have a flash (.swf file ) that i made in macromedia flash 8.0
and i want to add it to my page in asp.net/vb.net page
anybody can help me ?
thanks
|
|
|
|
|
Using a flash file has nothing to do with ASP.NET. You use it as you would on any web page.
---
b { font-weight: normal; }
|
|
|
|
|
please, i'm using th VS.net can u tell me how or give me the code. thanks
|
|
|
|
|
How can I add a javascript code and call it from the c# code in a web user control?
I am trying to open a new browser window when a button is clicked but i have to do some processing in the event handler then open the new window.Is there a way to do it?
Mohamed El Gohary
|
|
|
|
|
Use the RegisterClientScript method to add the code to the page.
---
b { font-weight: normal; }
|
|
|
|
|
But this only works with WebPartManager control. Are you sure this is the only way?
Mohamed El Gohary
|
|
|
|
|
What does only work with the WebPartManager control?
---
b { font-weight: normal; }
|
|
|
|
|
How to call acrobat dll in asp.net?Can any please send me the code using CSharp?
Scenario.
In my web form i have 2 Link buttons . If i click one of the link the pdf file should be loaded into our web form (I want to access the methods and properties of acrobat dll inside asp.net web form using CSharp) ?
Thanx in advance
|
|
|
|
|
I want to create a site using asp.net which enable people to vote for their fav idols. (SQL database will be used)
To be honest, I am looking for a all done codes so that i can focus on the other parts of the project.
Hope you guys can help me. Thanks Alot ....
|
|
|
|
|
any ideas about how to count number of words found when using the full-text search feature in sql server 2005 and high-light these words when i bind the search result on my web page...i'm using ASP .NET 2.0
Thanks in advance
Yasser Salama(MCP)
|
|
|
|
|
Hello All,
I am stuck with one problem. I am having one asp.net application in .net framework 2.0 and there is one link to open share point portal. I don't want to get login screen in share point when my user click the link from my asp.net application as he is already get login to my application.
Please help me ASAP.
Thanks,
Ritesh Shah
------------
ritesh4web@gmail.com
|
|
|
|