Browser Link In Visual Studio Is Not Working - asp.net

I'm trying to launch my web application (asp.net MVC) with debugging mode using Browser Link To Enable Edit Operations during Browser
but actually when i try to do this (Browser Link Not Working and it ask me to register the page inspector in the Web.Config)
Edit
and when i add the following to web.config nothing Happens
<add key="VisualStudioDesignTime:Enabled" value="true" />
<add key="PageInspector:ServerCodeMappingSupport" value="Enabled"/>
still i can't see that any browser connect through Browser Link
with knowledge that I Have Enabled debug=true in web.config
<compilation debug="true" targetFramework="4.6" />
and knowing that i have uninstall web essentials Package

I found this post very useful.
<system.webServer>
<handlers>
<add name="Browser Link for HTML" path="*.html" verb="*"
type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
resourceType="File" preCondition="integratedMode" />
</handlers>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
Take care in that the <modules> element might already exist.

Add the following in your web.config:
<appSettings>
<add key="VisualStudioDesignTime:Enabled" value="true" />
<add key="PageInspector:ServerCodeMappingSupport" value="Enabled"/>
</appSettings>

Related

RadEditor requires a HttpHandler registration in web.config

When I add this code to my aspx ,
<telerik:RadEditor ID="REWelcome" runat="server"
AutoResizeHeight="True" Width="500px" ToolbarMode="Floating">
<Content>
</Content>
<TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
</telerik:RadEditor>
And I got this error message ,
'~/Telerik.Web.UI.WebResource.axd' is missing in web.config.
RadScriptManager requires a
HttpHandler registration in web.config.
How can I solve it ?
In your web.config - add the following to the system.web (omit the system.web, just used to show you level:
<system.web>
<httpHandlers>
<add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />
<add verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"></add>
<add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"></add>
</httpHandlers>
The bottom two are not needed gnerally but I am assuming you want the extended features of the editor, like dialogs and spellchecking.
I also add location at the same level as system.web
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
You also have to add the Telerik.Web.UI.dll file in the bin folder of your application.
That worked for me.
These are the handlers needed for RadEditor and RadScriptManager:
<httpHandlers>
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
</httpHandlers>
and
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler"/>
<add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler"/>
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
</handlers>
</system.webServer>
source: http://www.telerik.com/forums/telerik-web-ui-webresource-axd-is-missing-in-web-config-f25e27e5a5ac
if the error message is like this::
~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager
Then you add the following into your web.config file:::
<httpRuntime targetFramework="4.5.2" />
<httpHandlers>
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>
I fixed it by changing the ASP Application pool from "Integrated" to "Classic" mode. All my configurations were correct, as described in other posts here. This is probably specific to my configuration, but may be worth trying.
I came across this issue while deploying to IIS 7.
You could set the Managed pipeline mode from Integrated to Classic. This indeed solves the problem with behaving IIS 7.5 as old 6.0 (with handler registered in old web.config node), but I wasn’t convinced that to use Telerik’s controls, I should use old type of pipeline.
Our old web.config file registered Telerik’s handler only in old section for IIS 6 (and that sufficed for cassini and IIS 6.0) and not in new section.
So I had to add this piece of xml to web.config :
<system.webServer>
<handlers>
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />
</handlers>
</system.webServer>
There is a very detailed KB article on this matter including all possible reasons for the error and how to fix it. Please check it out at Error: Web.config registration missing! The Telerik dialogs require a HttpHandler registration in the web.config file.
One of the best solutions is to open the web.config file and replace Telerik.Web.UI.DialogHandler.aspx with Telerik.Web.UI.DialogHandler.axd
<system.web>
<httpHandlers>
<add path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="Telerik_Web_UI_DialogHandler_axd"/>
<add name="Telerik_Web_UI_DialogHandler_axd" path="Telerik.Web.UI.DialogHandler.axd" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode"/>
</handlers>
</system.webServer>
and after that to set the RadEditor's DialogHandlerUrl property to "~/Telerik.Web.UI.DialogHandler.axd", i.e.
I got this error today when copying a published copy of a site from one server to another.
I figured that I shouldn't have to modify any scripts or code to get it to work again, after all, the site still worked just fine on its old server it is still being hosted on.
This is what I believe happened:
I copied the site files over, hooked up a site and bindings to it in IIS, and then tried to run it.
I got errors, and was forced to modify file handler bindings, the .net framework version of the app pool, and install new server roles/features to get it to at least produce this error.
I then deleted everything in the folder and re-copied the site files and it started working again.
IIS must have modified my site files in some way that prevented the site from working, and restoring the original code fixed it.
I know this is a very specific set of circumstances, but hopefully if someone else has the same situation some day they can solve it in the same simple way that I did.

UrlRewriting.Net not working even with a simple rewrite

I want to make URL rewriting using UrlRewriteNet module.
While I have added all the required config settings, nothing seems to take action even for simple rewrite.
web.config:
<configuration>
<configSections>
<!-- URL Rewriting.NET -->
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRewriteModule"/>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</modules>
</system.webServer>
<urlrewritingnet
xmlns="http://www.urlrewriting.net/schema/config/2006/07">
<rewrites>
<add name="GeneralRewrite"
virtualUrl="^~/Default.aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/MyDefault.aspx"
ignoreCase="true"
/>
</rewrites>
</urlrewritingnet>
</configuration>
Nothing more is requires as far as I understand to just rewrite the Deafault.aspx page to MyDefault.aspx. So I would expect my URL from https://server.address/Project.SiteName/Default.aspx to simply become https://server.address/Project.SiteName/MyDefault.aspx.
I use development in my local IIS 7 Windows 7 development pc but the release production server will be IIS 6 thats why I included both configuration into the web.config.
Unfortunately, and where there is no error for any reason, checked the IIS and saw that the module is registered in Modules section but the engine never runs !
Is there something that I miss here?
make the above in following manner
<configuration>
<configSections>
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission ="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection,
UrlRewritingNet.UrlRewriter" />
</configSections>
</configuration>
then comes the rewriting sections to rewrite urls
<urlrewritingnet>
<rewrites>
your urls to rewite will mapped here.....
</rewrites>
</urlrewritingnet>
and finally need to http module which will listen to the requests.
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
</system.web>
Except this no configuration needs to done in web.config just reference the dll (mandatory)
and .xsd file for intellisense
http://blog.vizioz.com/2009/11/add-intellisense-when-using-url.html
Open Web.config and add modules
<configuration>
<system.webserver>
<modules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</modules>
</system.webServer>
</configuration>

Why is my MVC3 web page not sending Windows credentials to IIS Express?

I have been struggling with getting Windows Authentication to work with my MVC3 application in development (VS 2010 SP1), with no real luck so far. I am running XP on my dev machine (no money until next year for an upgrade), if that makes a difference. I should also mention I am using IIS Express as the default web development server from VS 2010.
I started with an empty MVC3 app awhile back, as I didn't have the Intranet template available from the VS menu until I upgraded the MVC3 tools yesterday (OK, I was a little slow). Once I installed and inspected that template, I added a reference to DirectoryServices to my project and added the bit of code that displays the current logged-on user in the upper right corner of the page. According to the graphics, it should now say "Welcome PCE\dnewman!"
I followed the excellent instructions in this post: IIS Express Windows Authentication and did make some headway. However, I now get the 401.2 error from IIS Express, telling me I am not authorized...
So, I went in to my project properties and set Anonymous Authentication to Enabled. Now I can access the web page, but what I see in the upper right corner of my page is "Welcome !" -- no username.
I tried this with both IE and Firefox, with the same result. What the $#^&! am I missing here? It seems I am not logged in to Windows!! Where do I need to start looking for the problem?
At a previous employer a couple of years back, I wrote a Windows Forms app that authenticated the user with their Windows logon credentials. In that case, I had to take special care to both send the credentials and then to explicitly authenticate them on the service end. Is there something I have to do to make the browser include credentials with every GET or POST?
By request, here's the contents of my web.config, with apologies for all the Glimpse config stuff.
<?xml version="1.0"
encoding="utf-8"?>
<configuration>
<configSections>
<section name="glimpse"
type="Glimpse.Core.Configuration.GlimpseConfiguration" />
</configSections>
<appSettings>
<add key="ClientValidationEnabled"
value="true" />
<add key="UnobtrusiveJavaScriptEnabled"
value="true" />
</appSettings>
<system.web>
<compilation debug="true"
targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<pages>
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<trace writeToDiagnosticsTrace="true"
enabled="true"
pageOutput="false" />
<httpModules>
<add name="Glimpse"
type="Glimpse.Core.Module" />
</httpModules>
<httpHandlers>
<add path="glimpse.axd"
verb="GET,POST"
type="Glimpse.Core.Handler" />
</httpHandlers>
</system.web>
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false"/>
<windowsAuthentication enabled="true" />
</authentication>
</security>
<modules runAllManagedModulesForAllRequests="true">
<add name="Glimpse"
type="Glimpse.Core.Module,Glimpse.Core"
preCondition="integratedMode" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="Glimpse"
path="glimpse.axd"
verb="GET,POST"
type="Glimpse.Core.Handler,Glimpse.Core"
preCondition="integratedMode" />
</handlers>
</system.webServer>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IReporting"
maxBufferSize="1024000"
maxBufferPoolSize="1000000"
maxReceivedMessageSize="1024000">
<readerQuotas maxDepth="200"
maxStringContentLength="65536"
maxArrayLength="32768"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None" />
</binding>
<binding name="normalBinding">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint name="tcpAdminServiceEndpoint"
address="net.tcp://PCESRV22.pce.local:9000/ProductionMonitor/AdminService"
binding="netTcpBinding"
bindingConfiguration="normalBinding"
contract="Contracts.IAdmin" />
<endpoint name="tcpMasterDataServiceEndpoint"
address="net.tcp://PCESRV22.pce.local:9010/ProductionMonitor/MasterDataService"
binding="netTcpBinding"
bindingConfiguration="normalBinding"
contract="Contracts.IMasterData" />
<endpoint name="tcpReportingServiceEndpoint"
address="net.tcp://PCESRV22.pce.local:9030/ProductionMonitor/ReportingService"
binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IReporting"
contract="Contracts.IReporting" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc"
publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0"
newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<glimpse enabled="true" />
</configuration>
I am more than willing to divulge more details as needed, but I really don't even know where to start looking. Every post or article I can find seems to assume this part just happens as part of the Windows/MVC3/ASP.NET setup.
Thanks, Dave
If you follow all the recommendations in the referenced post, you'll end up with a non-working mess, like I did. Each answer has its own merit, but applying all of them only ends in frustration.
The post from Microsoft that answered all questions and got me working is here: How to Create an Intranet Site Using ASP.NET MVC
Save this link, it's golden...
I also found the "Add Deployable Dependencies" option can break Windows authentication. If I selected the "ASP.NET Web Pages with Razor syntax" option in the "Add Deployable Dependencies" dialog box, it immediately broke Windows authentication and seemed to go back to forms authentication -- I got a 404 error "The resource cannot be found" looking for /Account/Login. I didn't have to deploy it, just selecting that option broke it. The only way to fix it then is to start over. I was unable to remove enough of anything to get it to start working again, and I was unable to determine what change was made that caused this behavior.
This blog post saved the day: How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment" - it shows which assemblies are needed and how to get them included with your web app when you deploy it WITHOUT using the "Add Deployable Dependencies" nonsense.
I hope this saves somebody the hours I spent trying to get it all to work.

http error 500.19 - Internal server error

I am trying to get an application (that I didn't develop) running on a windows 2008 r2 64-bit server running IIS 7.5.
I am getting the above stated error - here are more details -
The requested page cannot be accessed because the related configuration data for the page is invalid
Error Code 0x8007007e
I know that the server can access the web.config, because if I make changes to it, the error code changes.
I also know that it is a correct web.config, because it is running successfully on a different server with the same file.
Does anyone have any idea what might be causing this. The error message I am getting really doesn't tell me anything.
I have tried using FailedRequestTracing, but either I don't know how to read those logs or there is no more information there. There are also no errors in the event logs on the server.
Where else can I look to get a better idea of what is happening?
Thanks for any thoughts....
EDIT - Here is the web.config. As I said earlier, it is strange that it is working on another server. I checked to ensure are referenced assemblies are available (as according to the page here, it appear that may be the problem) in the gac.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\temp\;deleteAfterServicing=false;" />
</appSettings>
<connectionStrings>
<!-- removed for this post -->
</connectionStrings>
<system.data>
<DbProviderFactories>
<!--<add name="IBM Informix .NET Data Provider 3.0.0" invariant="IBM.Data.Informix.3.0.0" description="IBM Informix Data Provider 3.0.0 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.3.0.0, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>-->
</DbProviderFactories>
</system.data>
<system.web>
<httpRuntime maxRequestLength="8192" />
<customErrors mode="Off" />
<sessionState timeout="360" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<clear />
</namespaces>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="5000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
<tracing>
<traceFailedRequests>
<add path="*.aspx">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="400-600" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
It's a bit cheaty, but Microsoft has a page specifically about this problem ... and myriad suggestions for fixing it. Have you gone through it yet?
http://support.microsoft.com/kb/942055
Try this http://windowslivehelp.com/thread.aspx?threadid=3dd85141-a45d-44d9-a94c-3c7d13cfcd5c
I was able to get past this error by disabling compression that is applied by having wsus on the server.
See details here.
Thanks for everyone's help.

How do I restrict access to files with specific extensions in ASP.NET?

I have in my web application an ADO.NET Entity-Framework *.edmx file.
When I browse in the browser (when the application is running) to an edmx file, it doesn't show the error page like when browsing to a *.cs or vb file, it opens the edmx and shows my model scheme to all the users!!!
How can I avoid that.
You should map the extension to the ASP.NET's System.Web.HttpForbiddenHandler class in web.config. If you are using IIS6, before you could do that, you should have mapped the extension to ASP.NET ISAPI handler.
IIS7 Integrated Mode:
<system.webServer>
<handlers>
<add name="MyForbiddenExtensionHandler"
path="*.edmx"
verb="*"
type="System.Web.HttpForbiddenHandler"
preCondition="integratedMode" />
</handlers>
</system.webServer>
IIS7 Classic Mode. Something like:
<system.web>
<httpHandlers>
<add path="*.edmx"
verb="*"
type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="MyExtensionISAPI"
path="*.edmx"
verb="*"
modules="IsapiModule"
scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
</handlers>
</system.webServer>
IIS6 (after mapping the handler to aspnet_isapi.dll in IIS6 configuration):
<system.web>
<httpHandlers>
<add path="*.edmx"
verb="*"
type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
</system.web>
You can do this two ways; firstly in the web.config or secondly in IIS
<system.web>
<httpHandlers>
<add verb="*" path="*.edmx" type="System.Web.HttpForbiddenHandler" />
</httpHandlers>
</system.web>
Here's a link to a microsoft support page that details how to do it in the web config and IIS.
http://support.microsoft.com/kb/815152

Resources