Last 50 Comments

re: IIS 7 Error Pages taking over 500 Errors
Tuesday @ 4:13pm | by Rick Strahl

@Anurag - Make sure you're not redirecting some errors elsewhere in the system. I think if you're using ASP.NET AUTH anywhere in the system it takes over the errors internally and handles redirection to authentication forms/endpoints. Technically a 401 isn't an error - it's a request to authenticate. Only if IIS gets failure authentication is it considered an error.
re: IIS 7 Error Pages taking over 500 Errors
Monday @ 10:40pm | by Anurag Sharma

This code works file for 500 error code but not works for other error codes like 401, i have a rest web service and i have to set the response code according to the functionality.
re: .NET 4.5 is an in-place replacement for .NET 4.0
Sunday @ 3:57pm | by Adam Plocher

Windows 10 Tech Preview build 9860 returns 4.0.30319.0 from Environment.Version. This means any version detection used in code is going to fail if you need the revision #. For example, I can't run Sharp Develop 5.0 RC because of this. See screenshot: http://i.imgur.com/S8ai4IZ.png
re: Using CSS Transitions to SlideUp and SlideDown
Sunday @ 1:21pm | by Peter Hobbs

Great job here Rick. Your excellent article made my weekend. Really appreciate your detailed explanation.
re: AngularJs and Promises with the $http Service
October 25, 2014 @ 1:49pm | by Jim

Nice article Rick... We decided to go the AngularJs route.. I do love ExtJS4 but it's not free and licensing is confusing.... I'll still use jquery grids...
re: ASP.NET Routing not working on IIS 7.0
October 25, 2014 @ 12:54pm | by Ashish Thakur

Thanks Rick for posting such good articles,

I am able to perform GET and POST request through WebAPI on LocalHost development server via AJAX .

After deployment to IIS server on AWS I am not at all able to perform GET and POST through AJAX.( I have referred your articles related to WebAPI and ASP.Net passing multiple parameters and like others)

I have noticed following points after deployment to IIS Server.
1) when I typed URL for WebAPI I am able to get JSON data as expected from AWS.
2) AJAX returning error on POST and GET request
3) Fiddler returns JSON data as expected for GET

Is it related to ASP.Net Routing ?
Appreciate your time and guidance.
re: WebAPI: Getting Headers, QueryString and Cookie Values
October 24, 2014 @ 12:12pm | by Will

return request.GetQueryNameValuePairs()
                        .ToDictionary(kv => kv.Key, kv=> kv.Value, StringComparer.OrdinalIgnoreCase);


This will throw an exception for duplicate key, if a query parameter is repeated.
re: UNC Drive Mapping Failures: Network name cannot be found
October 23, 2014 @ 1:07pm | by jtlodi

Wonderful Rick. Obviously you've more than VFP in your toolbox!
MadFox says "Hello"
re: WCF WS-Security and WSE Nonce Authentication
October 23, 2014 @ 8:19am | by nikz2

FOR PASSWORD DIGEST! It works, but need some changes,
1st
"<{0}:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#Digest\">" +
change to
"<{0}:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">" +

2nd as described here
http://stackoverflow.com/questions/19438000/working-algorithm-for-passworddigest-in-ws-security
re: Updated ASP.NET Database Resource Provider
October 22, 2014 @ 3:08am | by Mike

Could you please le us know where to start in order to change to a mySQL database? Thanks
re: HttpWebRequest and Ignoring SSL Certificate Errors
October 21, 2014 @ 8:24am | by Michael Bray

FYI this can now be set per-connection on HttpWebRequest in .NET 4.5
re: A jquery-watch Plug-in for watching CSS styles and Attributes
October 20, 2014 @ 12:18pm | by Rick Strahl

@Richard - Thanks for catching this and also for entering the issue on Github. Fixed.
re: Using FiddlerCore to capture HTTP Requests with .NET
October 20, 2014 @ 12:14pm | by Rick Strahl

@Solomon - did you actually read the post??? You can obviously capture output from other domains but you can capture localhost traffic. You can also capture SSL traffic but you have to enable it - see the bottom section of the post.
re: Help with working with multiple Unicode Locales in a VFP ANSI application
October 20, 2014 @ 11:49am | by Rick Strahl

@Marlo - the Codepage has to be the same both on the input end and the output end. So the database has to be in the right code page, the client that created the record had to be using the same codepage and the user on the other end reading the data has to use the same codepage. If anywhere in there the codepage doesn't match you get the ???? character translation issue.
re: A jquery-watch Plug-in for watching CSS styles and Attributes
October 20, 2014 @ 6:52am | by Richard

If I'm reading this right, there's a problem with reading the initial value of attributes:
$.each(data.props, function (i) { data.vals[i] = el$.css(data.props[i]); });

Shouldn't that be checking whether data.props[i] starts with "attr_", and calling el$.attr if it does?
re: Using FiddlerCore to capture HTTP Requests with .NET
October 20, 2014 @ 2:47am | by Solomon

Great work -request to server normally come from client anywhere not localhost. Hostname is confiured to this regards.Am I missing anything here please - do this program decrypt SSL from incoming request from another machine even though certificates was created in the code?. I can see this in code // Ignore HTTPS connect requests
if (sess.RequestMethod == "CONNECT")
return;
re: Help with working with multiple Unicode Locales in a VFP ANSI application
October 18, 2014 @ 10:04pm | by MARLO

hi is anybody can help me regarding the russian characters for example in the entry form or if you upload to foxpro 9 dbf files it became scrats ?????...
I already change the settings of my computer to russian but the same...if you type in foxpro dbf file russian character p the system will change it to b i dont understand why....
re: West Wind WebSurge - an easy way to Load Test Web Applications
October 17, 2014 @ 7:02pm | by Rick Strahl

@Joe - What would you like to see and which parts do you want open for automation?

Currently you have command line operation so you can fire off tests from a build process or test harness.

If you have a focused idea for a feature you're looking for you can open an issue on Github (https://github.com/RickStrahl/WestWindWebSurge/issues), or if you want to have a more interactive discussion you can leave a message here or on our message board (http://west-wind.com/wwThreads/default.asp?forum=West+Wind+WebSurge). I'd be happy to explore what you're thinking about...
re: West Wind WebSurge - an easy way to Load Test Web Applications
October 17, 2014 @ 5:46pm | by Joe

This tool seems very thorough. Can this tool be adapted to automate testing?

Thanks for the free tools and reasonably priced products your offer.
re: DataTable JSON Serialization in JSON.NET and JavaScriptSerializer
October 17, 2014 @ 8:49am | by Jacob

This might help someone in the future, maybe me after I forget what I did.

Made a change to the DataRowConverter to handle rows that are sub-tables. Note that the method uses the newer parameterization, passing the root JsonSerializer.

        public override void WriteJson(JsonWriter writer, object dataRow, JsonSerializer serializer)
        {
            DataRow row = dataRow as DataRow;
 
            //JsonSerializer ser = new JsonSerializer();
 
            writer.WriteStartObject();
            foreach (DataColumn column in row.Table.Columns)
            {
                if (column.GetType() == typeof(DataTable))
                {
                    DataTableConverter converter = new DataTableConverter(json);
                    converter.WriteJson(writer, column, json);
                }
                writer.WritePropertyName(column.ColumnName);
                //ser.Serialize(writer, row[column]);
                json.Serialize(writer, row[column]);
            }
            writer.WriteEndObject();
        }

re: Capturing Performance Counter Data for a Process by Process Id
October 14, 2014 @ 12:54pm | by Rick Strahl

Thanks for the reference, Andrei. I've run into the 'process goes away' problem with long running process monitoring myself so I can relate to that.

OTOH, in cases when you are monitoring specific processes it seems that you are likely profiling a longer running process or service so this is probably much less of an issue than with just a desktop application that might come and go frequently.
re: Capturing Performance Counter Data for a Process by Process Id
October 14, 2014 @ 8:28am | by Andrei

Good article! One thing to mention related to windows process instance names is that they change dynamically when one of the processes exits.

For example if chrome#8 exits, chrome#9 will become chrome#8 and chrome#10 will become chrome#9. At this point getting the value of the counter previously created for chrome#10 will throw an exception.
This is really annoying if you want to to monitor multiple instances of multiple processes as it gets down to monitoring process exits and recreating all the counters (really ugly).

One way would be to change the way process instance names are generated (see http://support.microsoft.com/kb/281884) but this has the potential of affecting other apps using the perfmon api.
re: Error on 64 Bit Install of IIS – LoadLibraryEx failed on aspnet_filter.dll
October 13, 2014 @ 6:21am | by Vlad

Thank you for posting this, helped me a lot. While searching for answers I saw that everyone else was happy with just enabling 32 bit apps on the application pool, you were among the few that were concerned about the root problem.

Cheers!
re: Self-Hosting SignalR in a Windows Service
October 10, 2014 @ 8:11am | by Matthew Nichols

Thanks for this Rick...I have had a hard time finding an example of calling into a Hub from an outside source to publish data to connected SignalR clients...this gets me started.
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 1:16pm | by Rick Strahl

@Miki - For me opening the file doesn't work properly either. The code simply doesn't step the display. As you say the debugger seems to work - I can step and see the next stop in the call stack, but the file display doesn't keep in sync. Even if the same file worked with most apps these days my code steps through many source files. I'll check Canary again but last I checked a few days ago this didn't work.

What's frustrating is that it's intermittent. With some code it works just fine. With other code it simply doesn't work at all.
re: Westwind Application Configuration Updates
October 09, 2014 @ 1:05pm | by Rick Strahl

@Dirk - List encryption works only if you encrypt the entire list in the .config provider. IOW, the top level list property on the object. It'll encrypt/decrypt the encoded list string. There's no support for individual list values.

JSON storage in the database is not directly supported, but you can use the string provider to generate the JSON and store and retrieve that from the db manually. You can open an issue on Github and add it as a suggestion. Would be easy enough to add this functionality as another provider.
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 11:48am | by PilotBob

I would suggest turning off source map support in the debugger. See if that helps.

There is always the IE debugger, visual studio, firebug, yea, I know... not helpful. ;)
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 6:14am | by Miki

If your source file is already visible, try F10 to step over and force a scroll to the next line. From my experience, the actual debugging works fine, the problem is the UI not showing the current line.
Where is the logged issue? I'd like to +1 and track it.
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 5:49am | by Jeremy

Ran into this as well. Is a known bug and only happens if you have the rev tools window up when the page is loaded. I switched to the dev version and it seems to be fixed there. Haven't run into it for a while.
re: Westwind Application Configuration Updates
October 09, 2014 @ 5:40am | by Dirk Beckmann

Hello I really love the Configuration Library. It's such a great tool!

I've got two questions. I'm using the SqlServerConfigurationProvider
#1. With support for Lists, how do I entrypt property in List objects? Is this possible?
#2. Is it possible to store the config data as JSON string in the database?

Best regards, Dirk
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 2:07am | by FJ

Hi,

Discussed a little over on twitter, however a couple more you could try (long shots though!)

- Have you tried in-congito windows? If this works, it could be an extension you have installed (which is probably synced on your Google account, hence it manifests elsewhere)
- Turn off "Use hardware acceleration when available" in the settings - long shot I know, but I've had very strange behaviour fix itself after turning this off.

Sadly I think Chrome is becoming more unstable as the bloat increases, which is a shame as it's so nice to work with!

Good luck.
re: Chrome DevTools Debugging Issues
October 09, 2014 @ 1:22am | by Rik Hemsley

Yes, same here, and again clicking the top of the call stack is a workaround for me.
re: A WebAPI Basic Authentication MessageHandler
October 09, 2014 @ 1:03am | by Nick Gilbert

I have updated to WebAPI 2.2 from nuget and now I find this approach doesn't work. The code walks the same path but the service always returns unauthorized.

Is there a way to get this working again under the current version of WebAPI?
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
October 08, 2014 @ 10:20pm | by Vetri

Hi Rick,

We have two IIS 7.5 web applications with below settings (2 different app pools),

1. Application 1 - Idletimeout = 0

2. Application 2 - Idletimeout = 20 (default value) - Application Initialization configured for this site.

Question 1

When we analyzed the performance of the both the sites, Application 1 is responding faster than Application 2 (After the new worker process generated due to idleness)

Question 2

For application 2, the new worker process gets generated after few minutes when the site is idle. What does this few minutes/ warm up period refer to? Where it can be configured? Is this based on Idletimeout?

Question 3

Assume like I have configured 'Application Initialization' for Application 1 as well (along with Idletimeout = 0)

Now if I recycle the app pool manually and assume no requests have reached the server yet, then will the Application Initialization sends the request after the warm up period?
re: Chrome DevTools Debugging Issues
October 08, 2014 @ 8:25pm | by Rick Strahl

@Matt - for me a refresh doesn't work. I have to quit. I'm going to give @Miki's not a try and see if that helps (can't check this very minute), but I don't think that'll work for me either as I can see the source file open, but still the line is not selected in the debugger.
re: Chrome DevTools Debugging Issues
October 08, 2014 @ 7:48pm | by Miki

Yes, I've seen it too. Hope it gets fixed soon. My workaround has been clicking on the top file of the Call Stack panel to make the source file visible, sometimes I have to hit F10 to force a scroll to the current line, actually next line.
re: Chrome DevTools Debugging Issues
October 08, 2014 @ 7:32pm | by Matt

Yes, I have experienced this too. I honestly haven't thought anything of it and just hit refresh then it started working correctly
re: Using JSON.NET for dynamic JSON parsing
October 08, 2014 @ 7:26pm | by Ryan

JSON.NET is fine for most JSON serializing when it comes to dynamic objects as long as ALL the properties on the object are dynamic.
If you have an object, say MyClass which implements a DynamicObject

    public class MyDynamicClass : DynamicObject 
    {
        public string MyStaticString { get; set; }
    }


then you try serialize this object you will notice weird behavior
var c = new MyDynamicClass();
c.MyStaticString = "foobar";
 
Console.WriteLine("JSON.NET: " + JsonConvert.SerializeObject(c));


Notice how the MyStaticString property is not there. Not ideal.
re: Resource Unloading in a custom ASP.NET Localization Resource Provider
October 06, 2014 @ 12:16pm | by Rick Strahl

@KA - You tell me. Why do you say the static is bad in this situation? Just because you've read somewhere that static is evil and not easily testable in some situations?

Resources are one time loaded entities and that's exactly the problem a static is supposed to solve - it's a reliable way to have a singleton object that is shared across threads.

Loading resources happens once per resource set, so this is not a high impact operation since it only happens once (per set). After that initial load, they're just parked in memory. What's not scalable about that? That's exactly how the .NET resource managers work, precisely because it IS scalable and works for a multithreaded environment.
re: Resource Unloading in a custom ASP.NET Localization Resource Provider
October 06, 2014 @ 3:53am | by KA

Do you have any other idea how this can be solved.
I don't like it this way. Because all the ResourceProviders with a lots of resources already cached are kepth in memory.
This way the app doesn't scale.

internal static List<IwwResourceProvider> LoadedProviders this is the ugly part. The static property :)
re: WSDL Imports without WSDL.exe
October 03, 2014 @ 1:15pm | by Alexander

this code don't work with this:
http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
however it work with the wsdl.exe tool
I trying to solve this for several days. Please any help will be significant.
re: Project Navigation and File Nesting in ASP.NET MVC Projects
October 03, 2014 @ 8:53am | by Natan

I like the idea of removing the blockinghandler and using JS and CSS together in the views folder. But after a while, I noticed that I'm not even using MVC views anymore, as pure html files makes most of the templates nowadays, and they go to the "app" folder.

I leave MVC views for cases where I want to pre-process html views with server-generated content. It is not common, but sometimes makes your life easier and the app faster.

Also, I have been using bower instead of nuget for all javascript/css dependencies. This removes any need to care for Script/Contents folder mess and I can just delete those.
re: Updated ASP.NET Database Resource Provider
October 01, 2014 @ 5:33pm | by Rick Strahl

The provider was designed for SQL Server, but it'd be fairly easy to modify the db access code to work with MySql. The SQL is very standard so if you provide the MySql provider it might just work.

Next update will have better provider support (Mongo and other SQL dialects) but for now you'd have to customize the DB access code.
re: Updated ASP.NET Database Resource Provider
October 01, 2014 @ 12:58pm | by john

Would it be possible to use a MySQL database?
re: Assembly Loading across AppDomains
September 29, 2014 @ 12:08pm | by Michael Brown

CHOLAN.R is correct. The code loads all dependencies within the parent AppDomain, not in the domain that you created.

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

It does not appear possible to load the dependencies in the newly created domain which is rather pointless, and I have not found a workaround for this as of yet. It never fires events on the new app domain (try it):

this.LocalAppDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
re: Web Browser Control – Specifying the IE Version
September 26, 2014 @ 6:57am | by Joe De Ville

Ahh! I see what I did now. It's javascript embedded in the content I used as a template.

Operator error, as usual. :-)

Thanks!

Joe
re: Web Browser Control – Specifying the IE Version
September 26, 2014 @ 3:36am | by Rick Strahl

@Joe - .innerText should always return text not HTML. If it's returning HTML you like had encoded HTML text in the element in the first place. Maybe the assignment was incorrect (ie. assigning HTML to .innerText).
re: Web Browser Control – Specifying the IE Version
September 26, 2014 @ 3:12am | by Joe De Ville

Rick,

Really appreciate all the tips and info over the years. This tip in particular has helped me with an issue that's plagued me for the last several years.

My application of the webbrowser control is not nearly as sophisticated as many of the posters here, but once I edited the registry, I was able to get correct rendering and other behavior in IE 11.

I do still have a problem, though.

The InnerText property of the document now contains (or at least now returns) HTML along with the text, where previously I was able to capture only the text.

Do you know of a simple way to extract only the text (i.e. remove any superfluous HTML?

Thanks for any help.

Joe
re: ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes
September 25, 2014 @ 5:24pm | by Bill Larkin

I puzzled and fought this for a whole afternoon. I didn't even know how to describe the problem and search the Internet for it. But then I stumbled on your write up that explained the problem. Thank you very much for a solution to a problem that was ruining my day!
re: Forcing an ASP.NET Application to 'stay alive'
September 24, 2014 @ 9:34am | by Rick Strahl

@Ron - you get 404 errors from what exactly? There's no reason that the response from an HTTP client wouldn't be same as from a browser unless the URL is incorrect. You may have to hardcode the URL explicitly rather than using relative or virtual paths to specify the URL.


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