# Wednesday, August 10, 2005

Carefully said I do not like that sharepoint "hijacks" the Internet Information Server. When you create a virtual directory it is just not accessable because SharePoint took over IIS.

Funny fact: This is the second post how to fix issues with IIS and "extension" that cause issues :-)

So i decided to hack a small utility serving my needs:

ExcludeFromSharepoint.zip (3.46 KB)

Enables to exclude applications from sharepoint services through the directory context menu.
Install using the "-install" switch; Uninstall using "-uninstall" switch.

Because I'm running my machine under a LUA (Limited User Account) i wrote the tool in a way that you can install and uninstall it without administative rights - the contextmenu will be installed per user!

if(args[0]=="-install")

{

    RegistryKey _rkey = Registry.CurrentUser;

    _rkey = _rkey.OpenSubKey("SOFTWARE\\Classes",true);

    _rkey = _rkey.CreateSubKey("Folder").CreateSubKey("shell");

    _rkey = _rkey.CreateSubKey("Exclude from Sharepoint");

    _rkey = _rkey.CreateSubKey("command");

    _rkey.SetValue(null, App.Application.ExecutablePath + " \"%1\"");

}

else if(args[0]=="-uninstall")

{

    RegistryKey _rkey = Registry.CurrentUser;

    _rkey = _rkey.OpenSubKey("SOFTWARE\\Classes\\Folder\\shell",true);

    _rkey.DeleteSubKeyTree("Exclude from Sharepoint");

}

else

{

...

}

 

The Implementation works with the webserver extensions version 4.0 or higher

 

    RegistryKey _rkey = Registry.LocalMachine;

    _rkey = _rkey.OpenSubKey("SOFTWARE\\Microsoft\\Shared Tools\\" +

        "Web Server Extensions",true);

   

    foreach(string _subKeyName in _rkey.GetSubKeyNames())

    {

        try

        {

            int.Parse(_subKeyName.Replace(".",""));

            RegistryKey _fpKey = _rkey.OpenSubKey(_subKeyName,true);

            _fpDir = (string)_fpKey.GetValue("Location");

        }

        catch(Exception _ex)

        {

            string _err = _ex.ToString();

            break;

        }

    }

 

and uses the stsadm.exe from the shared tools of the server extensions.

    System.Diagnostics.Process _p = new System.Diagnostics.Process();

    _p.StartInfo.FileName = Path.Combine(_fpDir, "BIN\\stsadm.exe");

    _p.StartInfo.Arguments = "-o addpath -url http://localhost/" +

        _strProjectName + " -type exclusion";

    ...

    _p.Start();

 

ASP.NET | C# | Indigo | Misc | Projects | Security | WebServices
Wednesday, August 10, 2005 5:43:48 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

I develop with 1.1 and 2.0 - When VS 2003 creates a web solution it is configured to use the 2.0 runtime. Placeing the following code to the Global.asax's of your 1.1 projects and setting execute permissions on the aspnet_regiis.exe helps much.

protected void Application_Start(Object sender, EventArgs e)

{

      if(System.Environment.Version.Major==2)

      {

            System.Diagnostics.Process _p = new System.Diagnostics.Process();

            _p.StartInfo.FileName = "%WINDIR%\\Microsoft.NET\\Framework\\v1.1.4322\\aspnet_regiis.exe";

            _p.StartInfo.Arguments = "-s W3SVC/1/ROOT" + Request.ApplicationPath;

            _p.StartInfo.UseShellExecute = false;

            _p.StartInfo.RedirectStandardOutput = true;

            _p.Start();

      }

}

 

ASP.NET | C# | Misc
Wednesday, August 10, 2005 11:56:11 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
I got an E-Mail from a student this morning asking how to thumbnail an uploaded image. Here is a "quick" solution (there are a few things you can do to increase quality, set JPEG compression factor or keep gif transparency). If you like to dig deeper have a look at one of the articles i wrote for the DotNetPro magazine's #Talk column (dnp0305_Thumbnail.pdf [German])

 

<%@ Page Language="C#" %>

 

<script runat="server" Language="C#">

 

    public void UploadFile(object sender, EventArgs e)

    {

        System.Drawing.Image _img =
             System.Drawing.Image.FromStream(
             this.InputTypeFile.PostedFile.InputStream);

 

        int _maxWidth = 100;

        int _maxHeight = 100;

 

        int _width = _img.Width;

        int _height = _img.Height;

 

        string _filename =

              System.IO.Path.GetFileName(

              this.InputTypeFile.PostedFile.FileName);

           

        string _uploadPath = System.IO.Path.Combine(

            Server.MapPath(".\\upload\\"),

            _filename);

       

        if (_width > _height)

        {

            width = Math.Abs((int)(height *

                        _img.Width /

                        _img.Height));

            _height = _maxHeight;

        }

        else

        {

            _height = Math.Abs((int)(_maxWidth *

                        _img.Height /

                        _img.Width));

            _width = _maxWidth;

        }

       

        System.Drawing.Image _newImg =

            _img.GetThumbnailImage(width, height, null, null);

           _newImg.Save(_uploadPath);

           _img.Dispose();

    }

 

</script>

<body>

    <form id="form1" runat="server">

 

    <input id="InputTypeFile" type="file" runat="server" />

    <asp:Button ID="Submit" OnClick="UploadFile" Text="Upload" />

 

    </form>

</body>

</html>

ASP.NET | C# | Misc
Wednesday, August 10, 2005 10:41:33 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, August 08, 2005
You Are an Espresso
At your best, you are: straight shooting, ambitious, and energetic At your worst, you are: anxious and high strung You drink coffee when: anytime you're not sleeping Your caffeine addiction level: high
Monday, August 08, 2005 2:13:41 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, August 04, 2005

Like Christian Weyer and Damir Tomicic I like the word Indigo more than "WCF" and just read that Kenny will continue to refer to it as “Indigo” for a little while.

 

Indigo | Misc
Thursday, August 04, 2005 11:04:45 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, August 03, 2005

...And i was just Added :-)

 

Shinja Strasser is the head of the NET UG Usergroups. He is publishing a main feed for the members under http://blogs.netug.de/. Now he opend the main feed for a few guys of the german community.

Wednesday, August 03, 2005 2:28:14 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, August 01, 2005

Boy, look at it - it's five now!

:-D 

Monday, August 01, 2005 1:30:41 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

First of all thank you to everybody who helped (Microsoft, INETA, S&S, E-Team...), spoke (Christian Weyer, Dirk Primbs, Achim Oellers, Dr. Holger Schwichtenberg) nad attended the event.

A few things learned:

  • Min. Session time is 60 min.
  • Print out the list of attendees ordereb by lastname ascending
  • Call restaurant to make sure the speakers diner will be served :-P

The feedback until now was very good and Stephan and I plan to do the ".NET Summit NRW 2006" next year. bigger, better, more

:-)

Monday, August 01, 2005 1:29:36 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Wednesday, July 27, 2005

Today 10:36 the last left attendee registration for the event I'm organizing with Stephan Oetzel came in.

:-)

More info: .NET Summit NRW.

Event | Misc
Wednesday, July 27, 2005 10:44:51 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, July 26, 2005

Mike Vernal figured out from where Microsoft's whole "evil empire" moniker comes.´

Must read :-)

Tuesday, July 26, 2005 10:59:23 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [16]  | 
# Monday, July 25, 2005

If you ever wanted to know where newtelligence headquarter is (Korschenbroich)...

http://virtualearth.msn.com/default.aspx?cp=51.188584|6.605851&style=r&lvl=9&v=1

You can also see where our next SOA Workshop will happen (Düsseldorf) on September 5 - 7, 2005.

Monday, July 25, 2005 10:08:46 AM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [25]  |