I am building a small web app that will include an activex control. So I've built the activex control, it works fine when I use it in an html page. From some reason it won't work when used in an aspx page. The authority popup that offers me to include the control won't appear when it's in the aspx page. The problem occurs both when I try using the page in debug mode throguh visual studio, as well when typing the page's url and entering it through iis.
Any ideas?
Edit:
when I open the html file through iis the activex is again no recognized, it seems to work only when I open the file through file system
I suggest you compare the HTML from your test HTML page with the HTML generated by the ASPX page. The difference in behavior is likely to do with the difference in HTML.
My guess is that the ASPX page is being served from a different domain than the codebase for the ActiveX control.
ok, an evening after I found a solution:
http://www.dreamincode.net/forums/showtopic38890.htm
apparently the activex control must implement the IObjectSafety interface. Hope this helps!
Related
When I double click on .aspx pages in my web application project in VS2010, instead of showing the mark up in the ide the .aspx pages are opening in the web browser as shown below. The same is happening when I run my application it opens all the .aspx pages in the web browser along the application url i.e., http://localhost123456/default.aspx. I have to close all the other pages except the http://localhost123456/default.aspx to run/ test my application. Not sure what would cause this to happen. I am not able to find any solutions so far, any help is appreciated. I used the option View Markup (Rightclick on aspx page -> view Markup) to see the markup for now.
Update
As per Mike's answer I checked the options under Open with... and I do have a Internet Explorer (Default) set as shown in the following image. Not sure how did it got there.
Deleting the Internet Explorer (Default) option might be cumbersome if I have lot of .aspx pages , if there is a way to remove this option at once for all .aspx pages rather than right clicking on each and every .aspx and remove it that would be great.
As per #JB King suggestion I did checked the file properties and all the .aspx files are set with Opens with: Microsoft Visual Studio option as shown it the image below.
Right-click any .aspx file in the project, select Open With...
In the screen that pops up, select Web Form Editor, then click the Set as Default button.
Not sure how you got Internet Explorer as an option here, but if it is there, you can just delete it. It's not applicable for loading the aspx from disk. Rather, to see the rendered page in IE, you'd do View in Browser or Browse With... (in which you can set your default browser, as well).
Your address bar shows you're loading files directly from disk. This won't work. ASP.NET is not lilke static HTML. ASP.NET applications must be run from within a webserver. Install IIS and ensure ASP.NET is installed and configured, or use the Debugging Webserver (IIS Express) in Visual Studio.
If you look at the properties of the file, there should be a line of Opens with: that is where you want to have Visual Studio rather than Internet Explorer as the issue is with which programs are mapped to what file extension. Microsoft instructions if you want those as specific steps to do.
How to compile to run the aspx page on a particular browser through C# code or any other other way.
which browser you want make it your default browser.Thats all
I am wondering are there any standard mechanisms available to protect the asp.net asp code in the client browser ? I found some references to Windows script encoders. Question is, are these script encoders encodes both aspx and code behind source ? If aspx is encoded with the Windows script encoders then how client browsers can decode it? Are they aware of the encoding algorithms ?
Or can we control the client browsers ( IE, Firefox, Chrome etc) to disable the view source option in the Tasks Menu when web site a loaded in them?
Any pointers will be appreciated.
The HTML code generated on a webpage is by definition public. It has to be accessible to the browser for it to be able to render the page properly. You will not find a reliable solution to hide the view source option in browsers.
To explain the basics a little bit :
When you create a page, you write markup in your .aspx file and some c# source code in the .aspx.cs file. The c# code is the server side code, which means that it is executed on the server (as opposed to, say, javascript which is executed directly in the client's browser -- client side).
When a page request is executed, the ASP.NET engine executes the server side code, and also executes the asp tags that you wrote in the .aspx page (for example : <asp:Button runat='server'... /> . It then spits out HTML code (this is a very simplified version of what actually happens).
The client's browser only ever gets the HTML (and it will not see the C# code nor any of asp markup code which is used to generate your page).
As I said before, the HTML generated is, and will always be public. There is nothing you can do to reliably hide it.
Server-side code (ie. code in code-behind pages, controllers, helpers, <% code nuggets %>, etc) will of course never be visible to a web client.
Your aspx or view pages (ie. .aspx, .cshtml, .vbhtml) files will also not be visible to web clients unless you have a signficiant security vulnerability, but the HTML generated by said files will be, along with any outputted or referenced JavaScript.
If the client couldn't read the HTML or JavaScript, how would the web browser be able to parse it?
Here's a question about obfuscating JavaScript, which will at least hinder but not completely remove a user's ability to view your source: How can I obfuscate (protect) JavaScript?
Similarly, one could theoretically obfuscate outputted HTML as well, but it could also be likely be reversed with some work.
It is impossible for the user to see your server-side (C#) source.
It is impossible to stop the user from seeing your client-side (HTML & Javascript) source.
In terms of javascript - the only thing you can do is obfuscate it to an extent that makes it worthless for someone to try to understand.
None of the code behind code is sent down to the client, only the rendered HTML.
there is no way to completely remove the ability for a client to view the source of your HTML. The only thing you can do is to obfuscate your HTML to make it harder for them to tell what they're looking at.
There are many libraries out there for obfuscating HTML in .net if you do a google search.
I'm confused really, but...
If you are on about the ASP.NET markup, you need not worry as any request to an ASP.NET page will cause the page to be compiled (if it hasn't already been, or isn't cached) which renders the page content as HTML.
If you are worried about people navigating to your code behind (e.g. mysite.com/SomePage.aspx.cs), you need not worry, as ASP.NET will not serve that content [unless the standard configuration has been changed].
If you are worried about people accessing your code through FTP, then I would suggest you change your compilation method and not deploy the source.
Am I missing anything?
I am using a dev express control: ASPxHtmlEditor version 10.1. I am trying to create a simple that only has this control. Unfortunately the control does not render with any of its styles or images loaded. This happens over 20 times. The control does not have any of its styles and all of its images do not load on the control.
I am getting 404 exceptions similar to: "Failed to load source http://localhost:11238/DXR.axd?r=5_0"
The cause of this issue is that the web.config file did not contain our http handler registration. So, such requests were not properly handled and scripts and images did not come to the client. Once you open the page in the designer, the http handler was registered and the problem disappeared :)
The solution was to restart my machine and open the page the control was on in design mode to have it create all the controls it needs to render properly.
I have developed a simple Silverlight control. I created this by using the Silverlight application project template in VS 2008, adding a test page to my existing website.
Now, my control works perfectly in the auto-generated aspx, where I have now got it functioning as required. However, when I try to put the control in a new page it does not load. Debugging suggests that the code is all executing, however the UI I expect to see simply isn't appearing.
I tried this initially in a content page using the correct master page for my site layout, and then just in a standard ASPX which doesn't use MPs...same problem.
Has anyone else experienced anything similar? Am I missing something simple!?
So frustrating, any help appreciated!
You can use Firebug or Internet Explorer's developer toolbar (and Fiddler) to see if the xap file is being requested and the rendered object tag has the proper size. If using the control check for any JavaScript errors.
Right-click the region where the Silverlight control should be to see if you get a Silverlight options prompt. That will tell you if the problem is in the loading of your Silverlight object into the page, or after the Silverlight plugin has loaded.