Home

Advertisement

Customize

ms_dot_net

IIS Application config wildcards

Jun. 10th, 2009 | 03:18 pm
posted by: [info]larryv in [info]ms_dot_net

I have an application in IIS where I set up a wildcard so that all file extensions are processed via the .net dll. I did this so that I can process some URL rewriting. I see at the top of the configuration screen where I can specify which extensions should be processed by what processors. What I am wondering is if there is a way to specify an extension that should not be processed by the wildcard. Specifically I know that .jpg, .gif, .css, .png and .js extensions should not go through it. Is there a way to tell IIS to just serve them normally?

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

Client-side validation

Feb. 27th, 2009 | 05:13 pm
location: Work
mood: frustrated frustrated
music: Linkin Park — Numb
posted by: [info]owenblacker in [info]ms_dot_net

I’m having some “fun” with client-side validation on a roll-my-own BaseValidator subclass.

My validator is to validate email format and includes the following code (with XMLdoc removed for brevity):

using System;
using System.Text.RegularExpressions;

namespace IrisDigital.WebControls.Validation
{
   [System.Web.UI.ToolboxData("<{0}:EmailValidator runat='server'/>")]
   public class EmailValidator : BaseValidator
   {
      protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
      {
         base.AddAttributesToRender(writer);

         if (base.RenderUplevel)
         {
            writer.AddAttribute("evaluationfunction", "CheckEmailFormat");
            writer.AddAttribute("controltovalidate", this.GetControlRenderID(this.ControlToValidate));
         }
      }

      protected override bool EvaluateIsValid()
      {
         // ...
      }

      protected override void OnPreRender(EventArgs e)
      {
         base.OnPreRender(e);

         if (base.RenderUplevel)
         {
            if (!Page.ClientScript.IsClientScriptBlockRegistered("IrisDigital.WebControls.Validation.EmailValidator"))
            {
               Page.ClientScript.RegisterClientScriptInclude("IrisDigital.WebControls.Validation.EmailValidator",
                  Page.ClientScript.GetWebResourceUrl(this.GetType(), "IrisDigital.WebControls.Validation.EmailValidator.js"));
            }
            this.ClientValidationFunction = "CheckEmailFormat";
         }
      }

Most of the rationale for doing things this way is from an article on CodeProject: RequiredIfValidator — Extending from the BaseValidator class, which does it precisely this way.

The validator works wonderfully. But the client-side validation never fires.

The WebResource correctly gets added to the page as a script include (for which I need to have the following line in my AssemblyInfo.cs, in case you were wondering):

[assembly: System.Web.UI.WebResource("IrisDigital.WebControls.Validation.EmailValidator.js", "text/javascript")]

, but it just never gets called.

Anyone got any ideas why?

Cross-posted to [info]csharp and [info]owenblacker.

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

Accessing an XML-RPC service

Aug. 11th, 2008 | 05:35 pm
location: Work
mood: frustrated frustrated
music: Með suð í eyrum við spilum endalaust — Sigur Rós
posted by: [info]owenblacker in [info]ms_dot_net

I'm trying to access an XML-RPC service from C# that I'm building. I've had absolutely no response from my message on the XML-RPC.net YahooGroup, so I started looking at the only other .Net XML-RPC class library out there: XmlRpcCS, which is only confusing me further.

The cause of my problems appears to be that XML-RPC.Net seems to require all its proxy objects to be structs. I, however, would like to use class objects, so I can add other functionality into the classes (constructors, the ability to have properties that are masked from the XML-RPC output and so on).

Now if this were XML serialisation, I would use the attributes that control XML serialisation, such as [XmlIgnore]. Without rewriting half of the class library, though (which would seem to defeat the purpose of using it!), I can't do something like that.

Does anyone here have any experience of using an XML-RPC library for .Net?

(Cross-posted to [info]csharp.)

Link | Leave a comment {1} | Add to Memories | Tell a Friend

ms_dot_net

Possible .Net regex bug?

Aug. 2nd, 2007 | 05:08 pm
location: Work
mood: frustrated frustrated
music: Elton John — Rocket Man
posted by: [info]owenblacker in [info]ms_dot_net

For reasons too dull to explain, I’m trying to use regular expressions to postprocess an HTML-stream. I want to find all anchor (<a/>) tags that link within our site, in this case using the domain name.

My regular expression looks right to me, but .Net is convinced I don’t have enough close-parentheses. I’ve added line breaks for clarity:

   (?<=<a[^>]* href=['"]?)
   (?<before>https?://[a-z0-9.-]*uswitch\.[a-z]+/[-\w_,.%/~]+)
   (?<querystring>\??[-\w&=~]*)
   (?<fragment>#?[-\w&=~]*)
   (?=['"]?[^>]*>)

I’ve tested both the above code with the line breaks removed and the original code (which is compiled with RegexOptions.IgnorePatternWhitespace and has embedded comments for ease of maintenance. Each time, I get a System.ArgumentException: parsing "..." - Not enough )'s.

Despite that I’m quite certain they’re perfectly matched.

Anyone?

Cross-posted to [info]regexp.

Link | Leave a comment {2} | Add to Memories | Tell a Friend

http://xmlia.com

Mar. 20th, 2007 | 12:45 pm
posted by: [info]xmliacom in [info]ms_dot_net

Dear friends!
We are glad to you to inform on opening new, absolutely free-of-charge site about online XML-validator and web-based editor.

For what to pay huge money for different win-based editors or to put the unchecked cracked copies?
Use our site, and you should not install anything on computer.
Our site does not contain advertising, is quickly loaded,consumes not enough traffic and quickly processes your data.
At your service XML visualisation not only in the form of TREE, but also in the form of GRID, that is actually avaliable only in very expensive windows XML editors.

all what you need to do-its just register for free

See you in http://xmlia.com

Link | Leave a comment {1} | Add to Memories | Tell a Friend

ms_dot_net

Quick rant before my meeting

Mar. 13th, 2007 | 03:00 pm
location: Work
mood: pissed off pissed off
music: Feeder — Forget about Tomorrow
posted by: [info]owenblacker in [info]ms_dot_net

Why is it that Microsoft appear to be completely incapable of writing decent code and documenting it?

I'm trying to work with SharePoint 2007 for a project at work. The developer textbooks haven't yet been published (and the release dates have recently been pushed back), so all I have to rely on is the MSDN Library's documentation of the API.

So when I see method descriptions like this (BaseFieldControl.RegisterFieldControl, fuck only knows what it does), I get pretty pissed off.

So I gave some feedback:

This is a public API, that developers need to access to work with SharePoint. Why on earth is there absolutely no documentation on some of these properties and methods?

Ridiculously poor; if one of my developers passed it to me for QA, I would have failed it and sent them to go do it all again, whilst hanging their head in shame.

I wonder if anyone will actually ever read it.

Cross-posted to [info]owenblacker

Link | Leave a comment {3} | Add to Memories | Tell a Friend

Technical Analysis API

Mar. 2nd, 2007 | 03:07 pm
posted by: [info]nesteruk in [info]ms_dot_net

Hello! Can anyone point me in the direction of a free .NET API for technical analysis? Thanks.

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

FastFourier Transforms

Jan. 11th, 2007 | 04:56 pm
posted by: [info]madkatsjournal in [info]ms_dot_net

Hello again :-)

Can anyone recommend a .Net FFT library that doesn't do anything with imaginary numbers, into which I can throw an Array of Int16 being a WaveForm and get out an Array of Int16 of the same size being the FFT analysis? Inverse FFT would be a nice feature, too.

Link | Leave a comment {2} | Add to Memories | Tell a Friend

ms_dot_net

More VB.Net aimed, but someone might be able to help...

Jan. 9th, 2007 | 10:29 am
posted by: [info]madkatsjournal in [info]ms_dot_net

This is cross-posted elsewhere.

Can anyone point me in the right direction for enumerating the Classes within my Assembly, and then enumerating the Members of those Classes?

The plan is this:
I'm using a very lightweight database engine (SQLite - specifically, the System.Data.SQLite wrapper which is fantastic - you can also link it with your binary, Google for ILMerge)
What I want to do is to write a number of Classes which inherit from a generic Database Table Base Class. The Base Class has a Method called SelfCheck. This Method (called on all Classes which inherit from the Base Class at startup) checks the table in the database against the Members of the Class, and takes action if there is a mismatch. The action may be to CREATE TABLE, or to rebuild the table with any extra columns which were missing. This allows for a quick, simple & transparent upgrade path for the end user, and means I (or others in the future) won't have to keep messing about with table generation scripts.

Link | Leave a comment {4} | Add to Memories | Tell a Friend

ms_dot_net

(no subject)

Jan. 7th, 2007 | 10:13 pm
posted by: [info]westy704 in [info]ms_dot_net

For those who are interested in DotNetNuke ASP.NET content management system have a look at new site www.olegzhukov.com (www.olegzhukov.com/content) The author is going to write articles on DotNetNuke and other .NET - related topics. Welcome to all :)

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

(no subject)

Oct. 7th, 2006 | 01:46 pm
posted by: [info]katty_kat in [info]ms_dot_net

Hi, i'm just a student, so don't be too strict ;)
I have a problem using a DataGrid in my VB.NET application.
So, what's the problem?
I have a DataGrid, it's DataSource is set to a DataView which gets data from a DataSet, connected to MS SQL DB through SQLDataAdapter.
So, I need to add and edit entries in my DataGrid, applying this changes to my database...
So, how can I do it (I mean applying my changes)?

x-posted

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

(no subject)

Aug. 21st, 2006 | 12:17 pm
music: Vinnickaya Alena - Izmuchennoe serdce (Gorchitza Remix)
posted by: [info]_villain_ in [info]ms_dot_net

The issue I have encountered with is that while writing the web service on c# one of the parameters of the method that should be used is a array of structure. The issue is actually that the client written on ColdFusion doesn’t see my method and while launching it crashes it and displays the error. "Web service operation "test" with parameters {t2={{A={[{PRICE={12},NAME={Myname}}]}}}} could not be found. "

My question is what is the right way to declare the variables in the web service? (It is not advisable to change the client as I’m writing the web service for the client and not vice verse.)

Here the code of the client and web service. )

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

Databinding methods such as Eval(), XPath(), and Bind() …

Jul. 19th, 2006 | 03:18 pm
location: Work
mood: too hot and irritable too hot and irritable
music: Quallofill — Paper Dress
posted by: [info]owenblacker in [info]ms_dot_net

I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious.

I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control" when I start my page. Unless I'm missing something obvious, this is not the same issue as the "2-way databinding cascading lists" issue (which is linked from everywhere; I kinda wish that were my problem ;o)

I have a templated databound custom server control, that I've built with a great deal of help from the two articles by 4GuysFromRolla's Scott Mitchell (1, 2).

I don't seem to be able to use databinding syntax, however:

   <ItemTemplate>
      <asp:TableCell runat="server"><%# Eval("First") %></asp:TableCell>
      ...
   </ItemTemplate>
bound to a List<Pair> gives me an exception:
[InvalidOperationException: Databinding methods such as Eval(), XPath(),
and Bind() can only be used in the context of a databound control.]
   System.Web.UI.Page.GetDataItem() +90
   System.Web.UI.TemplateControl.Eval(String expression) +110
   ASP.owentest_aspx.__DataBind__control8(Object sender, EventArgs e) in
      c:\Projects\Customisation\RedesignProtoTypeWeb\Owentest.aspx:13
   System.Web.UI.Control.OnDataBinding(EventArgs e) +80
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +198
   System.Web.UI.Control.DataBind() +12
   System.Web.UI.Control.DataBindChildren() +214
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
   System.Web.UI.Control.DataBind() +12
   System.Web.UI.Control.DataBindChildren() +214
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +208
   System.Web.UI.Control.DataBind() +12
   uSwitch.Web.UI.Lego.RepeatingInputRow.CreateItem(Int32 rowIndex,
      Table container, Boolean useDataBinding, Object rowData) in
      C:\Projects\uSwitch.Web\UI.Lego\InputModule\RepeatingInputRow.cs:361
   uSwitch.Web.UI.Lego.RepeatingInputRow.CreateControlHierarchy(Boolean
      useDataBinding) in
      C:\Projects\uSwitch.Web\UI.Lego\InputModule\RepeatingInputRow.cs:452
   uSwitch.Web.UI.Lego.RepeatingInputRow.DataBind() in
      C:\Projects\uSwitch.Web\UI.Lego\InputModule\RepeatingInputRow.cs:643
   Owentest.Page_Load(Object sender, EventArgs e) in
      c:\Projects\Customisation\RedesignProtoTypeWeb\Owentest.aspx.cs:20
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
      o, Object t, EventArgs e) +13
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
      sender, EventArgs e) +45
   System.Web.UI.Control.OnLoad(EventArgs e) +80
   System.Web.UI.Control.LoadRecursive() +49
   System.Web.UI.Page.ProcessRequestMain(Boolean
      includeStagesBeforeAsyncPoint, Boolean
      includeStagesAfterAsyncPoint) +3716

I don't get the exception if my databinding control is outside the table cell but, for a handful of other reasons, including that my ItemTemplate is being instantiated inside a TableRow, that won't work for me.

Any ideas gratefully received, as I'm completely lost. If you don't want to leave thoughts as a comment on here, feel free to email me (owenblacker at uswitch dot com). Cross-posted to [info]owenblacker and [info]ms_dot_net.

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

FYI - new resource:

May. 24th, 2006 | 09:25 am
posted by: [info]level42 in [info]ms_dot_net

www.iis.net

Link | Leave a comment | Add to Memories | Tell a Friend

Website forms

May. 7th, 2006 | 07:29 pm
posted by: [info]mc_funkymcmeep in [info]ms_dot_net

I'm making a client-side application that monitors the status of a website and reports what it finds. I have that part working, but now I need to add the ability to have my application automatically submit information through a form on the site (textboxes and submit button style.) I have no clue how to do this, any suggestions?

Thanks

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

myspace.com is hiring .NET developers!

Apr. 19th, 2006 | 11:27 am
posted by: [info]spice_of_life in [info]ms_dot_net

They are hiring developers like crazy! Email your resume to myspacejobs@yahoo.com.

Job description )

Link | Leave a comment | Add to Memories | Tell a Friend

ms_dot_net

Reading a book on ADO.NET - highly recommended.

Apr. 9th, 2006 | 02:18 am
posted by: [info]level42 in [info]ms_dot_net


When developers design systems, much of their time is focused on making sure that a particular piece of functionality can be accomplished. If we finish our design at the point where we can get the functionality to work, however, we are doomed to fail. Let me tell you a story from my past where I was more worried about the functionality than the performance.

Some years back I was charged with writing some code to enable doctors using a pen computer to pick a medication for a prescription. I wanted the doctors to be able to pick from any drug so I thought, simple: create a list box with all the drugs. I wrote the database queries, the screens, and the reports that would shoot out prescriptions on a printer for the doctor. Everything worked end to end on my machine.

The day I released it to the testers I was excited to watch it work for them, so I camped myself in the QA lab for the day. I was expecting to be available to field questions about the application, but they got to my screen and it seemed like it froze up. The hourglass cursor just sat there, mocking me. We gave up after a few minutes. I was perplexed.

That night, QA forgot to reboot one of the pen systems and left it running overnight. Surprisingly, the next day they brought me one of the units and showed me that the screen was up. As I played with the screen, I noticed that all the drugs had names starting with the letter 'A'. When I tried to move the scrollbar, it froze up again. I asked the QA people how many drugs were in the database. They answered, "About twelve thousand, why?" "Oh," I replied. I had tested with 40.

I ended up changing the list box to a grid that could page and load only the drugs that could be shown on the screen at one time. What did I learn that day? I learned that understanding the capacity of a system is crucial to finding the right solution. So, should you worry? Of course you should.



hopefully, the author won't sue me for this :-)

The book is "Pragmatic ADO.NET: Data Access for the Internet World"
by Shawn Wildermuth

Link | Leave a comment {7} | Add to Memories | Tell a Friend

ms_dot_net

anyone dabble in dotnetnuke?

Feb. 13th, 2006 | 08:54 pm
posted by: [info]terramayfield in [info]ms_dot_net

Just trying to surround myself with people that are doing the same stuff as me..

Link | Leave a comment {1} | Add to Memories | Tell a Friend

Cursor position

Feb. 5th, 2006 | 09:21 pm
posted by: [info]mc_funkymcmeep in [info]ms_dot_net

I'm trying to basically make a simple notepad app in C# .NET and I want to display the cursor position, but I can't figure out a property or event to get it to work. Any suggestions? Thanks

Link | Leave a comment {1} | Add to Memories | Tell a Friend

ms_dot_net

HttpCachePolicy in an IHttpModule

Jan. 30th, 2006 | 05:54 pm
mood: Google is not my friend :o( Google is not my friend :o(
music: Fleetwood Mac — The Chain
posted by: [info]owenblacker in [info]ms_dot_net

I'm having some trouble sorting out image caching for JPEGs that are served through an IHttpModule.

A quirk of the site I'm working on at the moment is that product images are served via a third-party image hosting provider (Scene7, who have been very helpful and so deserve a credit). In order to save having to reference the URI stem all over our code, I wrote an IHttpModule that parses all requests on the basis of:

   HttpContext context = ((HttpApplication) sender).Context;
   HttpRequest request = context.Request;

   Regex r = new Regex(
      @"/images/products/(?<sku>[A-Z0-9-]+)_(?<size>\d)\.jpg",
      RegexOptions.Compiled | RegexOptions.IgnoreCase);
   Match m = r.Match(request.RawUrl);

   if (m.Success && request.HttpMethod == "GET")
   {
      // Handle the Scene7-specific stuff
   }
   else
   {
      // Set cacheability
   }

Before I was doing anything in this else clause, Fiddler was showing me that the following headers were being sent with all non-Scene7 JPEGs:

   Pragma: no-cache
   Cache-Control: no-cache
   Pragma: no-cache
   Expires: -1

Now, if I add the following two lines to my else clause:

   HttpCachePolicy cache = context.Response.Cache;
   cache.SetAllowResponseInBrowserHistory(true);

it gets rid of the Expires: -1 header. Adding any / all of the following, though, won't shift the Pragma: and Cache-Control: headers — they all seem to have no effect on my actual HTTP transaction, so it's still not being cached properly:

   cache.SetCacheability(HttpCacheability.Public);
   cache.SetMaxAge(new TimeSpan(30, 0, 0, 0));
   cache.SetExpires(DateTime.Now.AddDays(30));
   cache.SetLastModifiedFromFileDependencies();
   cache.SetValidUntilExpires(true);

Does anyone have any real experience with setting HttpCachePolicy properties from within an IHttpModule? Am I missing something really obvious?

If you don't want to leave thoughts as a comment on here, feel free to email me (owen dot blacker at wheel dot co dot uk). Cross-posted to [info]owenblacker and [info]ms_dot_net.

Thanks everyone!

Link | Leave a comment {6} | Add to Memories | Tell a Friend