Recent Comments



Rick Strahl
April 23, 2016

re: Windows 10 Bash Shell Network Connectivity not working?

@Mark - yup found that out as well and got a note from one of the program managers that this has been addressed but the fixes didn't make it into the 14328 build. Hopefully this stuff will show up in the next drops or maintenenace releases.

Mark
April 23, 2016

re: Windows 10 Bash Shell Network Connectivity not working?

Everything you mentioned as broken in 14316 is still broke in 14328. Thanks for the resolv.conf tip, it didn't even exist in my installation I had to create it.

Daniel B
April 22, 2016

re: Using plUpload to upload Files with ASP.NET

Rick, what do you do (or can you do) when attempting to upload images larger than the httpRuntime maxRequestLength set in the web.config (default if unset is 4,096 KB)? If this is not set, or is too low, then any attempts to upload a file over this amount will result in the file _seeming_ to have uploaded (no error thrown, progress bar increments as if the the upload is happening) but the file isn't in the destination folder, because the web server throws the error 400 (bad request) quietly.

I'm tempted to increase the maxRequestLength to some ludicrous-high value, but then that leaves the door open to malicious attempts (DOS). I'd rather let the client set their value, but be informed if they attempt to upload something too large, so they know they need to adjust this value higher, or deal with the upload some other way.

ivar
April 22, 2016

re: "Variable is assigned but its Value is never used" Warning

Did the same thing, thank Google. I thought the compiler is smart, then I thought I am smarter.

bardia
April 18, 2016

re: ClientIDMode in ASP.NET 4.0

is there any solution to clean up 'name' property of control , like this "ctl00$content$txtName" to this "content" ?

Ryanba29
April 18, 2016

re: Web Browser Control – Specifying the IE Version

In c# at least you can specify System.AppDomain.CurrentDomain.FriendlyName.ToString() in place of the executable name. That way you don't have to change your executable name for debug mode.

Mark
April 14, 2016

re: Windows 10 Bash Shell Network Connectivity not working?

Thanks for posting this. I had a different variation of the same problem. I was connected to a VPN when I installed, so my first DNS server was on a network that I was not always connected to.

Gert
April 12, 2016

re: Windows 10 Upgrade and IIS 503 Errors

Thanks. Just upgraded from Windows 8 to 10. Got this same problem and simply repairing the module solved the problem.

Rolando
April 12, 2016

re: Using Let's Encrypt with IIS on Windows

Hello there, so this process (win-simple) is not as easy as it seems. I have attempted numerous times in trying to install the certificate and this is the error I have received. I did go into IIS and moved the static file above the extensionlessurlhandler, so that is correct. The only thing left is the web_config file?? Please help, and let me know if the web config file needs to be updated/corrected, and to what it should be. Thank you very much for your time.

This could be caused by IIS not being setup to handle extensionless static
files. Here's how to fix that:
1. In IIS manager goto Site/Server->Handler Mappings->View Ordered List
2. Move the StaticFile mapping above the ExtensionlessUrlHandler mappings.
(like this http://i.stack.imgur.com/nkvrL.png)
3. If you need to make changes to your web.config file, update the one
at C:\Users\rolando\Desktop\letsencrypt-win-simple.v1.9.0\web_config.xml

Rick Strahl
April 12, 2016

re: Google AdSense for AJAX Content

@JackyWest - yes for Angular I use similar code like that for Google Analytics and that works fine and that code will work globally if you have ads on the page, but only with the first one.

Rick Strahl
April 12, 2016

re: Use IIS Application Initialization for keeping ASP.NET Apps alive

@Eniep - This is an application specific value - I use a custom configuration class to store this URL, but you can use whatever works for your to house that value (AppSettings, static value etc.).

Jackywest
April 12, 2016

re: Google AdSense for AJAX Content

Hi,
I've stumble upon your website many times and I noticed that your really skilled and you know what your doing. I just wanted to say thank you for sharing your solution. I've been searching for that kind of solution for quite a long time. And even i've not tried to implement it yet it's really refreshing to see that we're not alone on this problem.
Google not supporting Ajax and SPA website is a joke to me, why the best tech company in the world would not support his own new trending framework ? And more the using of new web technology... It's not like they don't know we exist !
I find it sad for all programmer who had skill and want to make a few bucks. We built internet everyday and we can't use it for leaving, or with hard times. Anyway that was just my feeling on this quest.

Back to the main subject, I've think of this kind of solution, playing with the request and the URL.
So to summup your solution is to change the URL and Title on each change and fire google ads right after ?
Can we do this on one place like "locationChange" ?

$rootScope.$on('$locationChangeStart', function () {

// update the navigation history/url in addressbar
window.history.pushState({ title: '', URL: href }, "", href);

// fire google ads
(adsbygoogle = window.adsbygoogle || []).push({});
});
Something like that ?

Anyway the fact that your using on your own website is trusting me to use it on my own.
I'll start implementing it today.

Thank you again.

Tristano Ajmone
April 12, 2016

re: Web Browser Control – Specifying the IE Version

GREAT ARTICLE! It was very useful...

Just one CORRECTION:

You mentioned the registry key value "11001 (0x2EDF)", but it should be "11001 (0x2AF9)" instead!

I stumbled on this error while testing this feature inside an app using WebBrowser Control — decimal and hex didn't add up, so I realized it was a typo.

It really works smoothly. Before this hack, I could only use IE4 HTML4 in my apps using the WebBrowser Control... but tweaking the registry as adviced here, resulted in HTML5 + CSS3 pages showing up nicely inside the WebBrowser Control!

I guess the hard part will be to now carry out all the research in order to make sure the app checks out which version of IE is present on the system. There are legion of hacks (from HTML comments to JavaScript) to do that, but most of them are intended for the web. In the context of compiled applications, the checks should be restricted to IE only. If I find a clean solution I'll paste some links/examples here...

Eniep
April 11, 2016

re: Use IIS Application Initialization for keeping ASP.NET Apps alive

Thanks so much for the great post!!! This was exactly what I was looking for. I'm having one small issue though. I can't find
App.AdminConfiguration.MonitorHostUrl
Is there a special namespace I need to import? I'm working on a WebApi2 app.

Thanks again!!!

Rick Strahl
April 10, 2016

re: Using Let's Encrypt with IIS on Windows

@Spongman - you're not going to renew every day. The WinSimple task **checks** every day to see if the cert has expired, but it doesn't renew it every day.

Spongman
April 08, 2016

re: Using Let's Encrypt with IIS on Windows

If you're going to run the renew script every day, why not just have cents that last two days?

Rick Strahl
April 08, 2016

re: Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application

@Joe - OWin is separate from any particular framework, so what's described in this post can be implemented with Web Forms or raw Handlers/Modules. But the operation is optimized for MVC and routed URLs which would make handling non-MVC/Web API applications a more difficult target for this. You'd have to implement custom route handlers most likely to make it work.

The post describes a scenario that doesn't use the default EF identity implementation - it only uses the oWin components but none of the authorization or user management pieces which are deferred for storage in the application.

Rick Strahl
April 07, 2016

re: Configuring ASP.NET and IIS Request Length for POST Data

@Bryce (and several others) - thanks for the reminder that the IIS request filter specifies the value in *bytes* while the ASP.NET httpRuntime value is specified in *kilobytes*. I've updated the post.

Bryce
April 07, 2016

re: Configuring ASP.NET and IIS Request Length for POST Data

It should be noted that "httpRuntime maxRequestLength" is specified in kilobytes and "requestLimits maxAllowedContentLength" is in bytes. If you want the values to be the same, be sure to adjust the numbers accordingly.

Kevin
April 06, 2016

Joe Pool
April 06, 2016

re: Adding minimal OWIN Identity Authentication to an Existing ASP.NET MVC Application

Hi Rick,

I was directed here from the Asp.net forum.

I have an existing ASP.Net web application. It is *not* MVC!

Will (should) the steps here enable my ASP.Net web application to permit my members to log in using OWin or would I run into other problems?

If this is possible, after a member logs in using the OWin process, what would I need to do to match up that login identity to a member in my application's SQL database where I store all of my members by their email address?

Bert Cotton
April 04, 2016

re: Nuget Dependencies and latest Versions

Following up what Rick said, by targeting a specific version and then having NuGet resolve a difference version is very concerning. It removes the ability to guarantee reproducible builds. Building today and targeting 2.54.0 may not have the same result as building tomorrow and targeting 2.54.0, if NuGet pulled in 2.54.1.

This seems backwards from other package management solutions, such as Maven and NodeJS.

It would be helpful if in my project.json I could specify this behavior. Maybe a strict version keyword or something.

Rick Strahl
March 29, 2016

re: Reversing Sort Order on DOM Elements using jQuery

@Mark - yeah that's the beauty of it. You can use whatever sorting logic you want and it's pretty easy to do...

Mark
March 29, 2016

re: Reversing Sort Order on DOM Elements using jQuery

Love it Rick, it also gives you hands on control which can be handy. A simple change like
if (sort.length > sort2.length)
and you are sorting by the length of the list elements. Hope you are well!

Chirag Pathak
March 28, 2016

re: Add a Web Server to your .NET 2.0 app with a few lines of code

Thanks for this great article on BeginGetContext, it really helped me a lot....

Sean Cleaver
March 26, 2016

re: Azure VM Blues: Fighting a losing Performance Battle

Thought it was just me, thank you for the great detailed post. I tried Azure a few years back to host our website and an attempt at a SaaS application. I used WebSites and SQL Azure and a few VM's I found that the site was always going down despite the whole idea that it was always up, the SQL Azure DB's would just fail to connect every now and then and the VM's were just not up to the task. I decided that to use Azure you need to ensure you use multiple servers and zones for everything and replicate your data to get any kind of reliable uptime. This is Waaaaayyy too expensive for small sites. The changes to SQL Azure for DTU based pricing makes SQL really expensive when you start getting a few DB's especially when there tiny.

I moved over to Amazon EC2 and SQL RDS been running for about 18 months like this with no downtime it was far cheaper too with just a t2.small and t2.micro SQL Express Instance the total cost is about the same as 1 Azure VM.

Amazon RDS is great you get a SQL Express instance that you can install multiple small DB's on with automated backups that just runs.

The Desktop under Amazon EC2 is still a little sluggish (I couldn't DEV from it) but nothing like Azure at least you can use it.

Setting up a Private VLan in Amazon is easy, were as in Azure I could not find how to keep my SQL Azure DB's private. You have IP filtering but that's no good with Websites and you can block the internet but doesn't stop anybody with an Azure account.

I have tried Azure again this weekend since I really would like it to work but the VM just feel far too slow you can't do anything from the desktop. So I give up I will stick with Amazon and RDS it's not too expansive and works really well.

CardMagik
March 24, 2016

re: Application that won’t Pin to Taskbar in Windows 7

VB.NET app pins fine on my personal desktop but not on a server (Citrix pointing to Windows Server 2008). Name didn't matter (in my case, the name was DriveMapper). I read above someone had a problem with pinning from a network drive and that was EXACTLY my issue. When I put it on a local drive (like the server desktop), it could pin fine. So no pinning for that app from a network drive. Thanks for helping solve the mystery. Now I can move on.

Luis Palacios
March 23, 2016

re: AngularJs ng-cloak Problems on large Pages

The nuclear option actually help me a lot dealing with elements in a modal, thank you!

AJ
March 22, 2016

re: UNC Drive Mapping Failures: Network name cannot be found

I am getting same error but the difference is that I am trying to read this at runtime in a batch job. So my code logs in to the server with an id that's part of Local Logon group. It reads through all the shared folders (hundreds). I get "The Network name cannot be found." in about a 100 of the folders. Rest of them work as expected. Any clues as to why this subset of folders are failing?

Thank you,
AJ

Rick Strahl
March 20, 2016

re: Creating STA COM compatible ASP.NET Applications

@BJan - you can use EXE COM servers, but there's a lot more overhead in doing so unless you cache the DCOM servers and use them on their own dedicated threads. Many years ago I built a framework called Web Connection for Visual FoxPro servers that uses such a COM thread pool which works pretty well. It's not anywhere approaching native .NET performance but we're able to wring out about 300 req/sec out of this setup. It's workable but it requires a bit of work to build a good thread manager, which might just be better spent re-writing your code. In my case it's a generic product that was rebuilt, and surprisingly the performance of the .NET version was actually considerable (2x!) faster than the native W32 ISAPI implementation that preceeded it.

BJan
March 20, 2016

re: Creating STA COM compatible ASP.NET Applications

Thank you very much. Hmm, the actual performance bottleneck is COM call and marshalling. It sounds like converting an EXE project to COM Dll (to be used in .net) is not going to be a good approach because there will be multiple COM calls to perform a single operation and there will be hundreds of end users. I must rewrite the code in .net but at the same time i am going to nullify the reliability of the existing code, right?

prasanna
March 20, 2016

re: Passing multiple POST parameters to Web API Controller Methods

Hi,
I want to pass model values to webclient.in a model there are nested model
like 1-{2-{3}}..i am trying to pass
DWMedicationDetails dwMedicationDetails = new DWMedicationDetails();
DWDoseModel dwDoseModelInfo = new DWDoseModel();
DWDoseIntakeRoasterModel dwDoseIntakeRoasterModelInfo = new DWDoseIntakeRoasterModel();
dwMedicationDetails.RowId = Guid.NewGuid();
dwMedicationDetails.Name = Name;
dwMedicationDetails.Note = Note;
dwMedicationDetails.UserId = UserId;
dwMedicationDetails.CreatedById = UserId;
dwMedicationDetails.CreatedOn = System.DateTime.Now;

dwDoseModelInfo.dwDoseIntakeRoasterModel = dwDoseIntakeRoasterModelInfo;
dwMedicationDetails.dwDoseModel = dwDoseModelInfo;
but at controller side i could get only dwMedicationDetails except nested model properties.
Please help me.

Rick Strahl
March 19, 2016

re: Creating STA COM compatible ASP.NET Applications

@BJan - yes you definitely should try to avoid COM interop, but when you need it, you need it!

When using STA/ASP.NET IIS sets aside a certain number of threads to run for the STA threadpool and those threads get dedicated to STA request handling. The rest of an application should be relatively unaffected - only those requests that use the STA components are immediately affected in performance.

All that is pretty much moot though - the STA overhead is minimal compared to actually making a COM method call including the COM marshalling and string type conversions etc.

Bottom line - don't use STA unless you have to, but when you do need to use it these mechanisms at least let you do it.

BJan
March 17, 2016

re: Creating STA COM compatible ASP.NET Applications

I am trying to share code between VB6 exe and a website. The original code is in VB6 so my idea is to convert all business logic to dll and share it between VB6 and asp.net. I was confused what to do with session/user specific code. I came across this blog, you are making ASP.NET to work as STA, don't you think it will kill the performance, the main idea behind multiple threads in ASP.NET?

Rick Strahl
March 16, 2016

re: Rebooting Database Localization for ASP.NET with West Wind Globalization 2.0

ASP.NET core (MVC 6) is not supported at this time. You have to use MVC5 or earlier. ASP.NET Core is unreleased at this point and in an unstable state anyway - there's no reason to build anything with it in its current state.

Yudhisthir Singh
March 16, 2016

re: Rebooting Database Localization for ASP.NET with West Wind Globalization 2.0

Hi,
I tried using the source code in my project with .net 5 (MVC 6) the DLLs are not getting referenced as it is showing version issue.

Dave Myers
March 14, 2016

re: Use IIS Application Initialization for keeping ASP.NET Apps alive

Great info. I keep going back to this page every time I have to set up a new IIS instance of my web application.

Jeff
March 14, 2016

re: An easy way to create Side by Side registrationless COM Manifests with Visual Studio

Great article! Was having a very difficult time getting an OCX to work in WPF and deploy properly but this got me on the right track!

Mark
March 11, 2016

re: WCF WS-Security and WSE Nonce Authentication

Thanks, exactly what I needed.

I used a standard date and time format string, as follows, to generate the same result:

    string created = DateTime.UtcNow.ToString("O");

Yuri
March 11, 2016

re: FontAwesome Fonts and Mime Types in IIS and other Web Servers

In my IISExpress ver.10.0 config directory inside "applicationhost.config" I found:
...
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
...
so I did extra entry only for woff2 like:
<mimeMap fileExtension=".woff2" mimeType="font/x-woff2" />

As you can see mimeType is "font/x-woff2" and this also is working fine

Thanks for article :)

Baraka
March 10, 2016

re: Self-Hosting SignalR in a Windows Service

Rick,
Quick question. How and where did you host your client HTML and JavaScript files? Where they hosted in the Windows Service install folder or where launched from somewhere else given that you didn't use IIS?

Panu
March 09, 2016

re: A WebAPI Basic Authentication MessageHandler

I have a self hosting Web API targeting .net4.0 with this authentication scheme. Problem I'm having is that Thread.CurrentPrincipal will always be the same once it is set. This means that if I try to connect with client A without authorization header I get 401 as I should. If then I connect with client B with authorization header I get normal response as I should. But now when I connect again with client A without authorization header I get normal response. Even if I connect with client A with wrong authorization header I still get normal response.

Rick Strahl
March 04, 2016

re: Code Magazine Article: Flexing your HTML Layout Muscles with Flexbox

@Anthony - no FlexBox is not a framework like Bootstrap - it's a core CSS feature that's built into the CSS rendering system. As such it's much more low level. However, FlexBox can all but replace the Grid System in Bootstrap.

Anthony
March 03, 2016

re: Code Magazine Article: Flexing your HTML Layout Muscles with Flexbox

Hi Rick, isn't Flebox very similar to bootstrap which seems to be far more popular? Example: http://getbootstrap.com/getting-started/#examples

robbie
March 03, 2016

re: A small jQuery Resizable Plug-in

Hi mr. Strahl ,I am trying to catch the element under mouse when dragging resizable(standard ui.js) i think there's two problems to acquire the target attributes.
#1 i see that any element being concurred by resizable element, is moving away so app-on release mouse button, it's not there...
#2 the area is either document (body), or the helper / ghost object.

so i ask my self is it really the tool to do the job? i'm actually building similar idea, which will let me generate a layout of divs visually,
so maybe with all the code all ready done to enforce the logic to get to the data of the "neighbor" being concurred ,
which is the very first step in the idea of many other stages needed (this one is tricky!!)
i might as well do it all from scratch no ui-resizable();
did you ever encounter the need and issues as i described ?
what's your thoughts about it, i will be happy to collaborate on this small project.

Mads Kristensen
March 01, 2016

re: Registering and Unregistering a VSIX Extension from the Command Line

Thanks for writing the post. We need more posts and articles about Visual Studio extensibility. If you haven't already seen it, then take a look at Extensibility Tools 2015 which makes it a lot easier to write VSIXs https://visualstudiogallery.msdn.microsoft.com/ab39a092-1343-46e2-b0f1-6a3f91155aa6

DictionaryMan
March 01, 2016

re: WebAPI: Getting Headers, QueryString and Cookie Values

NameValueCollection lookup speed is nowhere near the lookup speed of Dictionary<string, string>

From http://www.dotnetperls.com/namevaluecollection

NameValueCollection lookup: 2768 ms
Dictionary lookup: 407 ms

Rick Strahl
February 29, 2016

re: Using Let's Encrypt with IIS on Windows

@Gfw - I'm not sure about the revokation and limits. I think under normal scenarios this isn't a problem - old certificates should just scroll off. I think this is just growing pains and the .NET/Windows components currently don't support the revocation stuff but I'm sure it's coming. I think the deal is that if you have a problem with a cert you just create a new one as long as you don't have too many for a single domain (I created about 10 in testing I think) I don't think you'll run into this issue, which in a normal use case is pretty unlikely.

Gfw
February 29, 2016

re: Using Let's Encrypt with IIS on Windows

Thanks for the post, very timely. I used LetsEncrypt-Win-Simple, followed the instructions on a test site and all worked about perfect. BTW... I Also tried Cerify before reading your artile and had the same issue - no certificates were issued/installed.

Question...

What is the issue about not being able to revoke or remove teh certificate once it is issued? Is it something to be really concerned about?