I have installed Microsoft.VisualStudio.Web.BrowserLink and Microsoft.VisualStudio.Web.BrowserLink.Loader (separately, not together) on an ASP.NET Core 3.1 API project and on an ASP.NET Core 5.0 API project. In each app, Browser Link is disabled even when I open the browser from the Browser Link dashboard. Does this not work for API projects? I'm using Visual Studio 2019 Community Edition.
First, Browser Link is disabled by default in Visual Studio. Before using it, please remember to enable it first.
Second, check how the Microsoft Browser Link works:
Browser Link uses SignalR to create a communication channel between
Visual Studio and the browser. When Browser Link is enabled, Visual
Studio acts as a SignalR server that multiple clients (browsers) can
connect to. Browser Link also registers a middleware component in the
ASP.NET Core request pipeline. This component injects special <script>
references into every page request from the server. You can see the
script references by selecting View source in the browser and
scrolling to the end of the <body> tag content:
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"requestId":"a717d5a07c1741949a7cefd6fa2bad08","requestMappingFromServer":false}
</script>
<script type="text/javascript" src="http://localhost:54139/b6e36e429d034f578ebccd6a79bf19bf/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
For the WebAPI application, since it doesn't return the web page with above <script> script. The Browser Link can't detect the web API return data. So, in the Browser Link Dashboard, the API application keeps showing "no current connections" and Microsoft Browser Link not work for API projects (You could also click the "View in Browser" in the Dashboard, it will return a web page with 404 error).
To use Microsoft Browser Links, you could try to change the application to ASP.NET Core Razor Pages or MVC projects, then, the result like this:
Related
Problem:
We have a website written in ASP.NET hosted on an IIS server.
We want to start developing a new website using Java, Springboot, and AngularJS and want to deploy on a web server on the same machine (most probable apache tomcat).
For certain DOM elements on the ASP.NET website, after clicking on them I should be routed to the appropriate web page on the new website hosted on the tomcat.
How can we achieve this communication between these two websites?
If your DOM element is a link (the HTML anchor tag) you can just put the new website page's link as the href property and will just work. You can pass parameters in the query string.
If you are trying to submit a form on the ASP.net page to an end point on Tomcat, then use the Tomcat endpoint as the action property of form. Here you have an option of choosing GET/POST as the method.
If you are tyring to do Ajax requests from the ASP.net page to a Tomcat endpoint, you will get into a CORS issue. There are plenty of articles/tutorials on how to add a CORS header on Tomcat-SpringBoot that will help you out.
I upload images to the server via ajax which are saved in the directory wwwroot.
After this operation page auto refreshing like "browser link".
How can I disable tracking for change in some directories in wwwroot ?
Thanks!
It seems you are talking about the Browser Link and not Browser Sync which is an extension in Visual Studio for ASP.NET projects.
Unfortunately, in either of them, there is no way you can disable it for specific directories. You can only disable them completely. Click on the link given above to learn more on that.
I've created a asp.net mvc 5 app project (no app so far) when I go to http://localhost:12345/ it shows the asp.net default index page:
But if I go to http://development_machine_ip:12345/ from a remote machine it shows the unstyled page:
Note I am using Windows Authentication on an Intranet app. I am using the same credentials in both machines.
This issue is present in Firefox, Chrome an IE. The site is not being displayed in intranet compatibilitymode as suggested here
I've also set project folder permission to read and execute for all domain users and added the <meta http-equiv="X-UA-Compatible" content="IE=10.0" /> tag without success.
I am using IIS Express and Visual Studio 2013.
Thanks for considering my question.
SOLUTION:
the clue is to give the appropriate permissions to IIS_IUSRS. But until that it's easier to launch VS 2010 with administrator privilages.
Check this link provided in this question comments by #barry
I am trying to get my first hello world application on facebook using asp.net with facebook toolkit.
I am hosting my files on www.aspspider.info/jasminm89/ using it as a canvasurl
and link to my facebook app is http://apps.facebook.com/mytesterapp/
At that location i have: default.html page with the h1 tag with plain text.
When I visit my app on facbook I get message:
The page cannot be displayed
The page you are looking for cannot be displayed because an invalid
method (HTTP verb) was used to attempt access. Please try the
following:
Contact the Web site administrator if you believe that this request
should be allowed. Make sure that the Web site address displayed in
the address bar of your browser is spelled and formatted correctly.
HTTP Error 405 - The HTTP verb used to access this page is not
allowed. Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search
for the words HTTP and 405. Open IIS Help, which is accessible in IIS
Manager (inetmgr), and search for topics titled Setting Application
Mappings, Securing Your Site with Web Site Permissions, and About
Custom Error Messages.
here source code from facebook, where it loads my page:
<form action="http://aspspider.info/jasminm89/"
method="post" target="iframe_canvas"
id="canvas_iframe_post_4e513da6b75410144827584"
onsubmit="return Event.__inlineSubmit(this,event)"><input
type="hidden" autocomplete="off" name="signed_request"
value="xxx....."></form>
One point here.
I setup my account on 000webhost.com and by default there is default.php created,
I copy the link to my facebook and it loads the page, it worked as well with plain index.html.
final
This error is because with IIS we can't use static html pages to be called in this way
I now upload plain .aspx page with some text and it worked.
First this sounds like an error with your server configuration, not with accessing the Facebook API/SDK.
Secondly, don't you need to add the call to the facebook SDK and include the <div id="fb-root"></div> ?
Or are you using the C# Facebook SDK?
I iis you can not handle post method coming from facebook including signed_request.
So firstly reconfigure IIS allowing handle post method. Or for simple start make index.html as the default document, put inside "hello world", then process the second step.
I ran an ASP.NET page that i have under development on my local IIS. It uses some dragPanelExtenders as well as some other AJAX Control Toolkit AJAX client side stuff, and in order to show the page to somebody, I wanted to put it up as a plain HTML file, hosted on a live web server (running APACHE). (This is the only public web server I have access to, and I want them to be able to drag some panels and experience the page as it would be when "live")
So, I viewed the page running on my local IIS, then saved the source as a HTML file.
Then copied this HTML file to the web server ( as well as necessary CSS, JS and image files).
When I view this HTML file through the web server, I get this error :
ASP.NET Ajax client-side framework failed to load.
By debugging, I see that the following lines were in my saved HTML :
<script src="/Insata10/WebResource.axd?d=VAXZudqFsChpNfB" type="text/javascript">
<script src="/Insata10/ScriptResource.axd?d=Dwbyv-OIp-kJQdqf_UMh7wUzi2" type="text/javascript">
<script type="text/javascript">
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
So, at runtime, the referenced resources "ScriptResource.axd" and "WebResource.axd" were not found.
Is there any way to get whatever is needed from those AXD's to my HTML file, without actually executing anything on IIS?
Not easily. The Ajax Control Toolkit relies on server-side .NET Code, which runs in the context of IIS.
You can us a different web server, such as the Cassini web server that comes with Visual Studio (or write your own), but I expect that you're looking for a simpler solution, and none exist for what you're asking.
The bottom line is, the server-side code needs to run, and for that you need a server. You can't just open the file and have it work.
The best you could do would be to find similar javascript to get the desired funcitonality.
edit
I'm always forgetting about Mono, so if your Apache server is set up and configured correctly, you CAN run .NET code from an Apache server. http://www.mono-project.com/ASP.NET
Still not simple, though, so my answer of "not easily" does not change.