|
My control is deployed in <object>mydll/object>, in an aspx page. like http://localhost/myproject/default.aspx
How can I get the above url (where this object is installed) from inside the mydll object ?
Thanks,
varadhg |
| MigrationUser 1 Wednesday, September 03, 2003 4:43 PM |
I placed the following code inside my Web User Control and it gave me the URL of where it was being used, not where the control was. Hope that's what you wanted. Public ReadOnly Property TestTest() As String Get Dim strTest As String strTest = Request.ServerVariables("SERVER_NAME").ToString & Request.ServerVariables("PATH_INFO").ToString Return strTest End Get End Property |
| MigrationUser 1 Wednesday, September 03, 2003 6:17 PM |
No... I'm trying to get the url from inside my smart client dll object
It is a windows application (dll) hosted under IE.. After my application launches from the web, from my windows dll, i need to find what url I'm launched from ??
Thanks,
Gopi
|
| MigrationUser 1 Wednesday, September 03, 2003 8:26 PM |
Ahhh, Smart Client? That changes things . . . into something I don't know a lot about <u>yet</u>. Since Smart Client is based web services, you might have better luck asking this specific question in the ASP.NET web forums.
Also, if you would, what does the phrase, "...hosted under ID." mean? I've seen other people use it and I can't figure it out. I didn't think IE could host anything. Can it? Sorry of the dumb question. :( |
| MigrationUser 1 Thursday, September 04, 2003 12:28 PM |
"hosted under IE" refers to the technique of getting IE to display a Windows Form. Using object tags, IE can display a fully functional Windows Form or Control. It's a pretty sweet technique, though, calling it a smart client is a misnomer. See <a href="http://windowsforms.net/articles/iesourcing.aspx">this article</a> for information on how to accomplish this. |
| MigrationUser 1 Thursday, September 04, 2003 1:50 PM |
ok.. first I figure it (based on Chris sells wahoo Game, which is a good example of how to host an windows forms exe under browser..)
First the answer to my question !! is we have to use AppDomain.CurrentDomain.FriendlyName which gives the Url from which the assembly was downloaded...
Hosted Under IE means ... like this..
we develop a windows program and compile it to a dll say, myprj.dll
create a default.aspx and in the html view, <object id="mycntrl" classid=myprj.dll#namespace.myprj.classname></object>
That's it.. when you open default.aspx in browser, you will see the myprj.dll win program running under IE !! that's what I mena hosting under IE!! (note: IE always gets mispelled as ID !!)
Varadhg |
| MigrationUser 1 Thursday, September 04, 2003 2:21 PM |
Whoa! I've been wondering how to do that but didn't know what it was called. Didn't put the 2 things together. I love .NET more and more every day! (<i>Don't tell MS I said that.</i>)
Thanks guys! |
| MigrationUser 1 Thursday, September 04, 2003 4:41 PM |
If you can get the url of the above html that hosts the object, can the object have access to the document object model of the browser? thanks in advance |
| MigrationUser 1 Monday, September 22, 2003 5:12 PM |
Currently I'm also struggling with this problem but no success so far. The only thing I can advice you, is to get the URL from which the .net dll was downloaded (containing your control). But it will not be necessary the web page address, as your page may download dll from another location. but if they reside together it may help: Assembly.GetExecutingAssembly().CodeBase; |
| MigrationUser 1 Wednesday, September 24, 2003 11:47 AM |
Actually ( As far I know ) It is one way !! (Unless someone from MS tells otherwise !) You can call the Winform control Objects Properties & Methods from the DOM of the Browser(Say Javascript) but reverse not possible ..!!
I also need this badly !? MS are you there ??
All I need is a simple call a javascript from the button click event from the Winform Control Object ..
Thanks,
Varadhg
|
| MigrationUser 1 Friday, September 26, 2003 4:08 PM |
I have two ways to get this url from the Smart Client here: -----------------------------------------------------------------------------------------------------------
One way is to make the url from the Request.ServerVariables Collections in ASP.NET page in which the control host. Then pass it to the control via client script. You can implement this way with the following steps:
1. Place the following code in the ASP.NET page code behide:
protected string url; // the url you want
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // you needn't get the url everytime StringBuilder str = new StringBuilder(); str.Append("http://"); str.Append(Request.ServerVariables["HTTP_HOST"]); str.Append(Request.ServerVariables["PATH_INFO"]); url = str.ToString(); } }
2. Add a <param> tag to the <object> tag:
<param name="Text" value="<%=url%>">
"Text" is a Property which starting at the Windows.Forms.Control class.
3. You can call the control's public method which needs the url after the <param> tag we added has been loaded. For example:
<object id="winctrl" ...> <param name="Text" value="<%=url%>"> </object> <script>winctrl.ShowUrl()</script> -----------------------------------------------------------------------------------------------------------
Another way is to get the url from client script, then pass it to control via client script. The value of the location property in document object is the url we need. You can implement this way with the following steps:
1. Place the following code in the ASP.NET page:
<script> function ShowUrl() { var url = document.location.toString(); winctrl.ShowUrl(url); } </script>
2. Call the function above after the <object> tag has been loaded:
<object id="winctrl" ...> </object> <script>ShowUrl()</script>
----------------------------------------------------------------------------------------------------------- I am a junior from china. And my English is poor. If I have make some mistakes in expression. I hope you can point them out to me :)
|
| MigrationUser 1 Friday, November 14, 2003 7:37 AM |
I have two ways to get this url from the Smart Client here: -----------------------------------------------------------------------------------------------------------
One way is to make the url from the Request.ServerVariables Collections in ASP.NET page in which the control host. Then pass it to the control via client script. You can implement this way with the following steps:
1. Place the following code in the ASP.NET page code behide:
protected string url; // the url you want
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // you needn't get the url everytime StringBuilder str = new StringBuilder(); str.Append("http://"); str.Append(Request.ServerVariables["HTTP_HOST"]); str.Append(Request.ServerVariables["PATH_INFO"]); url = str.ToString(); } }
2. Add a <param> tag to the <object> tag:
<param name="Text" value="<%=url%>">
"Text" is a Property which starting at the Windows.Forms.Control class.
3. You can call the control's public method which needs the url after the <param> tag we added has been loaded. For example:
<object id="winctrl" ...> <param name="Text" value="<%=url%>"> </object> <script>winctrl.ShowUrl()</script> -----------------------------------------------------------------------------------------------------------
Another way is to get the url from client script, then pass it to control via client script. The value of the location property in document object is the url we need. You can implement this way with the following steps:
1. Place the following code in the ASP.NET page:
<script> function ShowUrl() { var url = document.location.toString(); winctrl.ShowUrl(url); } </script>
2. Call the function above after the <object> tag has been loaded:
<object id="winctrl" ...> </object> <script>ShowUrl()</script>
----------------------------------------------------------------------------------------------------------- I am a junior from china. And my English is poor. If I have make some mistakes in expression. I hope you can point them out to me :)
|
| MigrationUser 1 Friday, November 14, 2003 7:38 AM |