Last 50 Comments

re: Publish Individual Files to your Server in Visual Studio 2012.2
Yesterday @ 3:24 am | by Pawel

Is that is supposed to work with VS 2012 For Web? I've installed update but unfortunately there are any changes (I deploy via FTP)
re: ASP.NET 2.0 MasterPages and FindControl()
Thursday @ 6:10 pm | by Luis Damas

Public Shared Function FindControlRecursive(Root As Control, Id As String) As Control
  If Not (Root.ID Is Nothing) AndAlso Root.ID.ToUpper = Id.ToUpper Then Return Root

  For Each Ctl As Control In Root.Controls
  Dim FoundCtl As Control = FindControlRecursive(Ctl, Id)
  If Not (FoundCtl Is Nothing) Then Return FoundCtl
  Next
  Return Nothing
End Function
re: A first look at SignalR
Thursday @ 3:57 pm | by Rick Strahl

@Philip - I haven't run into that problem mainly because I've been using self-hosted servers for my work. The limitation there apparently isn't kicking in. But even on IIS on Windows 7/8 Pro you get 10 connections. That should be enough for most test scenarios?

@Brendan - unfortunately I can't with this particular project because it's a customer specific solution. I'll be posting more stuff in the coming weeks though and actually will condense this remote queue manager down to something that I can post as a semi-generic service.
re: A first look at SignalR
Thursday @ 11:47 am | by Brendan

Any chance of you sharing the source code of the queue application you built? I'm trying to implement this technology and would love to have a working model to look at. Cheers!!
re: A first look at SignalR
Thursday @ 5:21 am | by Ray

I've actually dabbled with SignalR myself and instantly fell in love with it. It's such an easy way to be able to push out global or grouped based messages in your web application in real time. I'm glad to see that it's catching some traction in the developer community.
re: Basic Spatial Data with SQL Server and Entity Framework 5.0
Wednesday @ 2:06 pm | by yust

Hi,

Great article! Too bad I can't open the project, because unittest project is missing or relocated.
re: A first look at SignalR
Wednesday @ 6:33 am | by Tyrone

The consideration about performance is really where the team should provide some guidance. I think it's great that you provided some warning to developers to not just dive head first into this without knowing how this may impact a production application.
re: A first look at SignalR
Wednesday @ 6:07 am | by Philip Andersen

We have been using SignalR for about a year (when it was just a side project). One thing I though hate is the issue when running on IIS 7 with Windows 7. It simply kills my IIS (http://stackoverflow.com/questions/9697746/when-compiling-a-project-with-signalr-i-have-to-do-a-iisreset).
Are you using IISExpress for development, or have you found a way around this issue?
re: Overriding ClientID and UniqueID on ASP.NET controls
Wednesday @ 4:38 am | by Chisha

Thank you very much I had a set of radio buttons that were being added
server side and also java script side which both needed to use the same
name otherwise the radio buttons will not see each other.

but I created a server control based on this article and it worked.

I didnt want to use JQuery to rename because thats not efficient
hence your solution is very good for the long run
and the page does not use post back so your solution works best.

Thanks
re: Linq to SQL DataContext Lifetime Management
Monday @ 1:43 am | by Dave

Hi
We implemented this functionality into our visual studio solution a while back and have only just noticed that something is not working. Our project uses LINQ to get the info from the database then assigns the properties to public properties within our POCO classes. We can then modify the POCO class properties within our WinForms, then to save the data to the database we re-assign the public properties of the POCO classes back to the LINQ classes to update the database using LINQ. This all works fine however if we have the exact same setup on another computer (computer 2) and click the refresh button on a form on computer 2 (after updating the database on the form on computer 1) the results are not refreshed on the grid on computer 2. The data is somehow being cached. I have an c-sharp example project with one LINQ Class, one POCO class and a database with one table in it which shows this if it is possible to upload it somewhere where someone could perhaps have a look at this or give some advice on this?
Many thanks
Dave
re: ASP.NET 2.0 MasterPages and FindControl()
May 18, 2013 @ 9:59 pm | by Rick Strahl

@Nick - that depends. WebForms is amongst the most optimized parts of ASP.NET. If you build tight WebForms (ie. little to no reliance on ViewState) those apps will run faster than MVC apps for example. Talking about slow tech, MVC uses so much dynamic and runtime reflection for inference of types etc. that it has quite a bit of overhead.

All in all the perf difference between the various ASP.NET platforms is relatively small either way though although I totally agree - if you use WebForms the way that most tutorials teach you and using massive third party controls you're quite likely to build a dog of an application. Same is true of other platforms though.

In short, don't spout unsubstantiated crap like that that is totally subjective and dependent on what you actually do in the specific application.
re: ASP.NET 2.0 MasterPages and FindControl()
May 18, 2013 @ 6:48 pm | by Nick

Scott Gu says: "One thing we worried about what the performance impact of people mis-using it -- since doing deep walks of the entire control tree lots of time can really slow things down if you don't know what you are doing. "

If anyone was really concerned about performance they wouldn't be using Webforms.
re: Web Browser Control – Specifying the IE Version
May 17, 2013 @ 2:12 am | by Rainer Euhus

Hi Rick,

Thank you for the information.

Solved a problem with a 'position: fixed' element, which wasn't displayed before I added the registry entry.
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 15, 2013 @ 1:13 pm | by David

Thanks for the responses.

I setup the deploy profile first, but still didn't see the new option.

After poking around a bit more I found this line in the changelog for the update:

"Selective publish – for one or more files you can perform the following actions (after publishing to a Web Deploy endpoint)"

Source - http://www.asp.net/vnext/overview/latest/aspnet-and-web-tools-20122-release-notes-rtw#_Web_Publishing

This makes it sound like it perhaps won't work with an FTP endpoint (which is what I'm using)? Rick, you said it should work with FTP/File transfer though? Have you had this work on your end of things?
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 14, 2013 @ 11:51 am | by Rick Strahl

@Steven - does a full Publish operation work?
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 14, 2013 @ 9:37 am | by Steven Carnes

I am on a MVC4 Application, with File System deployment set up and I still do not have the option. Any clue why?
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 13, 2013 @ 12:01 pm | by Rick Strahl

@David - This all makes sense. I believe you have to have your publish settings configured before you see the individual options since those options do not prompt for profile or settings - they use the current publish profile. So that would explain why you don't see it for the WebAPI project - yet.

The target server does NOT have to have Web Deploy installed to work. You can also use FTP and direct file tranfer (via UNC or network share).
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 13, 2013 @ 8:06 am | by Michael Lang

David,

I have an MVC4 project that it works on, and a Web API project that it does not work on. I have not setup a publish profile for the Web API project yet, but the MVC4 application does publish to Azure. So I presume the menu option requires knowing how to deploy to the target server, which must have Web Deploy 3.0.

Can you setup your Web site project to deploy to Azure, then verify if the menu option works or not. Azure does support Web Deploy 3.0, as that is what I use for my MVC4 web application.
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 @ 5:14 pm | by David

Hm, for some reason this option is not showing up for me.

I'm on VS2012.2, and I'm using a website (not a web project). I have set up the publish option on the actual site, and that seems to be ok. However, if I right click any files in the web site, I don't get the option to upload.

Any clue if this is restricted to just web projects?
re: Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 @ 12:55 pm | by Rick Strahl

@Bryan - I hear you, but I suppose you can always ask to get it installed - that's worked for me in the past. With Web Deploy 3.0 the install is painless and easy for a server now, which I think was a problem previously.

In fact I remember about 2 years ago I was working on a project where we needed to install Web Deploy and it simply didn't seem to work. It was pretty embarrassing :-) We ended up using the FTP deploy which worked but is quite a bit slower. Same location though was able to install Web Deploy 3 last year no issues, so there are definite improvements there.

FWIW, you can still use the publishing features with FTP for those hosts that don't support Web Deploy. It works great too, although in my experience it is a bit slower than Web Deploy.

re: Publish Individual Files to your Server in Visual Studio 2012.2
May 10, 2013 @ 11:11 am | by Bryan

I just wish more hosting companies supported Web Deploy. Since it's an extra installation instead of something that can just be turned on by checking a check box in a site's IIS configuration (or a web.config option) many of the smaller, more economical hosts do not support it.
re: A WebAPI Basic Authentication Authorization Filter
May 07, 2013 @ 4:17 pm | by Joe

Thanks for this article. Question... With Basic Authentication the Request is always made with an Authentication header. That part I get. Does that mean on every request to the Web API we are checking whether or not the username/password combination is valid? Would that be overkill to constantly validate the user?

I have an API Controller that returns data for a Get (GetContacts).
The client is a website and is using Jquery for autocomplete (as someone types in a contact it is calling the GetContacts controller with parameters and returning matching contacts for the autocomplete). The problem is that each request is being authetnicated and is slowing down my autocomplete piece. In fact, with the membership.validateuser method I am getting a deadlock (probably because it updates last login or something like that upon validating the user). I'm not sure of a way around this. Have you experienced this before?
re: Unable to cast transparent proxy to type <type>
May 05, 2013 @ 5:44 pm | by John

Hi Rick,

Thanks for the info. Am currently dealing with this problem now myself but could you clarify how the "AssemblyResolve" handler helps here. As pointed out by "CHOLAN" in your own article here:

http://www.west-wind.com/weblog/posts/2009/Jan/19/Assembly-Loading-across-AppDomains

Your handler is still loading the assembly on the current domain, though CHOLAN's solution to use the new domain doesn't seem to work either (but I'm new to this area so still researching things). Any assistance you can provide would be welcome. Thanks.
re: WCF WS-Security and WSE Nonce Authentication
May 04, 2013 @ 9:40 am | by Charlie

Hi, After spending nights and days on this for a beginner like me,,, I came to the point where I generated a Clientproxyclas using svcutil.exe. And then came to the understanding that I would need some custom bindings to accomodate nonce.. But How do I get to see the Soap XML. The SVClog file just shows some applicationdata and events..
re: A WebAPI Basic Authentication MessageHandler
May 03, 2013 @ 6:18 pm | by Rick Strahl

Yes it works just fine with .NET 4.0.

re: A WebAPI Basic Authentication MessageHandler
May 03, 2013 @ 5:05 am | by Paulo Morgado

@Rick, is the Web API supported on .NET 4.0? I thought it was 4.5 only.
re: A WebAPI Basic Authentication MessageHandler
May 02, 2013 @ 12:54 pm | by Rick Strahl

@Paulo - that's essentially the same code. The await roughly translates into a task.ContinueWith().

If the code is strictly for .NET 4.5 then the await is the way to go, but if also support 4.0 then Task.ContinueWith() is it.
re: A WebAPI Basic Authentication MessageHandler
May 02, 2013 @ 9:11 am | by Paulo Morgado

Rick,

Have you tried something like:

        var response = await base.SendAsync(request, cancellationToken);
 
        if (credentials == null && response.StatusCode == HttpStatusCode.Unauthorized)
                Challenge(request, response);
 
 
        return response;




Instead of:

        return base.SendAsync(request, cancellationToken)
            .ContinueWith(task =>
            {
                var response = task.Result;
                if (credentials == null && response.StatusCode == HttpStatusCode.Unauthorized)
                    Challenge(request, response);
 
 
                return response;
            });

re: Master Page Inheritance and User Controls
April 30, 2013 @ 9:21 am | by asok1421

@squirrl, you just saved my butt. thanks!
re: Problems with opening CHM Help files from Network or Internet
April 29, 2013 @ 11:45 am | by Norman Brenner

Rick: you've saved my life. The .CHM file for AvalonEdit failed in exactly this way, and your wonderful article fixed the problem immediately. Thanks a million!
re: Error on 64 Bit Install of IIS – LoadLibraryEx failed on aspnet_filter.dll
April 29, 2013 @ 8:14 am | by Joel

"c:\windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll"

If you notice in your screenshot it has two slashes between v4.0.30319 and aspnet_filter.dll. After removing one of the slashes it was reported to me that the error no longer occurred.

Also, on your screenshot of the ISAPI Filter screen. You can just right click on the entry and say edit.
re: A WebAPI Basic Authentication Authorization Filter
April 28, 2013 @ 5:19 am | by Dominick Baier

Why would you use an authorization filter for authentication - besides it seems to be the easiest solution....? There are also ordering issues with other (real) authorization filters. Message handlers are a better fit here.

http://leastprivilege.com/2013/04/22/web-api-security-basic-authentication-with-thinktecture-identitymodel-authenticationhandler/
re: A WebAPI Basic Authentication Authorization Filter
April 22, 2013 @ 11:02 pm | by Brad Vincent

Thanks for sharing Rick - could you also please release your token based auth filter on github - or a blog post about it would be great! thanks
re: Linq to SQL DataContext Lifetime Management
April 22, 2013 @ 12:49 pm | by Rick Strahl

@Okan - you should still be able to use HttpContext activation in medium trust. I believe only the thread based activation shouldn't work. Also make sure your context is public - if it's internal it won't work because private reflection is not available in medium trust.
re: Building a better .NET Application Configuration Class - revisited
April 22, 2013 @ 12:46 pm | by Rick Strahl

@Fred - Last week I also updated the NuGet package for Westwind.Utilities 2.0 which includes the new Application Configuration class. Just be aware that the new version is not 100% backwards compatible. The ApplicationConfiguration is the most prominent change - others are refactored classes and namespaces for more logic groupings.

PM > install-package Westwind.Utilities

If you use this package remove the Westwind.Utilities.Configuration assembly.
re: Building a better .NET Application Configuration Class - revisited
April 22, 2013 @ 7:58 am | by Fred Peters

Thanks Rick, it does work for the console application. I'll have to see what's different in my Winforms app.
re: Linq to SQL DataContext Lifetime Management
April 22, 2013 @ 7:26 am | by Okan SARICA

Hi
these context creation is very usefull i think this code not working on trust level medium

i am using a public hosting so this is a restriction for me and i must obey this trust level rule

what do you suggest than ?
re: A WebAPI Basic Authentication Authorization Filter
April 19, 2013 @ 3:21 pm | by Fred Besterwitch

Great article Rick. Very useful for me.

Thanks
re: A WebAPI Basic Authentication Authorization Filter
April 19, 2013 @ 11:54 am | by Rick Strahl

@Danillo - Basic Authentication requires the Authorization header on every request so every request is authenticated, so either the header needs to be there or the challenge is fired every time (as it does unless you pre-authenticate with windows HTTP clients).

I built token based auth for the app described above initially (and I may publish that next), but the customer actually did not want to go with that for this API - it's actually simpler with most HTTP clients to pass the auth credentials instead of tracking a token and inserting it into the header or URL.

Interesting idea though to use basic auth to request UID/PWD through basic auth in the first place though...
re: A WebAPI Basic Authentication Authorization Filter
April 19, 2013 @ 11:31 am | by Danillo Corvalan

Does the client who access this API have to pass this authentication on every request ? Or do you have to implement an access-token-ish way to deal with that ?

Thanks for sharing!
re: A WebAPI Basic Authentication Authorization Filter
April 19, 2013 @ 11:25 am | by Rick Strahl

@David - thanks. Those are good fixes and I've merged them in. Appreciate it - missed the challenge in refactoring :-)
re: Web Browser Control – Specifying the IE Version
April 19, 2013 @ 11:10 am | by Tom Py

Thanks SO much. I just started getting script errors this year in an app I wrote years ago that actually stopped loading data from site when it got the error. With this fix, which I did not see anywhere else through Google, my app loads the flash data properly.
I'm using ie10 in windows 7 and 270f hex worked for me.
Thanks!
re: A WebAPI Basic Authentication Authorization Filter
April 19, 2013 @ 8:29 am | by David Ruttka

Looks like good stuff, thanks for sharing! =) I had a couple of thoughts while reading through it that I felt it was easier to express in code. Here's the pull request https://github.com/RickStrahl/WestwindToolkit/pull/1
re: Handling mshtml Document Events without Mouse lockups
April 18, 2013 @ 2:44 pm | by el dude

BUMP!

I'm facing this challenge but in VB 2008.

It looks like whatever event I add a handler for, all other events become ignored.

A HTML page loads and I hook the onmouseover event. The handler writes everything I mouseover to a list (as an example I found on Microsoft does) but the browser does not respond to anything else (mouse clicks, double clicks, or keystrokes) BUT it does respond to mousewheel actions and the backspace key...

I see that some found success in other implementations... Has anyone found success in VB 2008?
re: An Introduction to ASP.NET Web API
April 18, 2013 @ 11:33 am | by jose

I don't normally comment... But your article helped me a lot. Thanks for writing the article! Read a couple of books but your article clarified a lot of things.
re: Crashing WCF 3.5 JSON Services with DateTime.MinValue
April 18, 2013 @ 2:31 am | by Naveen

Thanks for the article. It helped me a lot. My application was locking itself as you said in the article. I couldn't realize that, it is DateTime data member which caused the issue unless I read this article.
re: WebAPI: Getting Headers, QueryString and Cookie Values
April 16, 2013 @ 5:00 am | by Richard

If request.GetQueryNameValuePairs() can return null, as implied by your GetQueryString method, shouldn't your GetQueryStrings method check for that?
re: WebAPI: Getting Headers, QueryString and Cookie Values
April 16, 2013 @ 3:09 am | by Rick Strahl

@Ross - I'm sure there's some reason to this - most likely it's more efficient than a dictionary and can be streamed. Still it's silly to have to futz around with a clunky interface like this. I think nobody looks and tht and goes right on - it'll throw anybody into a 'WTF do I do with this?' for a few cycles at least.
re: WebAPI: Getting Headers, QueryString and Cookie Values
April 16, 2013 @ 2:14 am | by Ross Smith

Spot on Rick, this has annoyed me too

IEnumerable<KeyValuePair<string,string>> - genius


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2013