Making web apps is like…

code, web No Comments »

Making web apps is like programming a cross-platform application for several OS’s that are changing radically every month.

WSS 3.0 and ASP.NET Applications Coexisting

SharePoint, code No Comments »

Getting WSS 3.0 and ASP.NET apps to coexist on port 80 (this includes web services) is pretty straightforward. The toughest part is figuring out how to do it.

I had originally tried and tried to get SharePoint to install on the “Default Web Site” at W3SVC/1. Well, that wasn’t happening–don’t know why, but it wasn’t. I used both SharePoint Central Administration and STDADM with extendvs and it still created a new website named “SharePoint - 80″. Oh well…

So then I started moving the applications from the Default Web Site to “SharePoint - 80″. At first I tried DotNetNuke and a webservice as two separate test scenarios. It took hours of trial and error (and reading Inside Microsoft Windows SharePoint Services 3.0, which has an excellent security section) to finally get both apps to work.

The trick: “Full Trust” on the root web.config.

Selah

Now, don’t go running out and doing that on the WSS site. It’s bad business. Write your applications correctly specifying the proper permissions needed and do your best to make the app run in WSS_Minimal or WSS_Medium trust. Better yet, create a custom trust level and install it in WSS. Then your application is truly enterprise ready.

Ok, with that said, I can’t be sued.

Anyway, adding Full trust to the root web.config and setting up your applications normally (just using the “SharePoint - 80-” website) and you’ve got WSS and ASP.net applications coexisting happily. They even work with WSS managing the root folder (explicitly, that is). That means you can have a SharePoint site on the root of your website and ASP.net applications in other virtual directories.

Enjoy!

Clear QueryStrings in ASP.NET

code 3 Comments »

Everyplace I looked for a solution to the QueryString.Clear() problem (that is, you can’t clear the querystring in ASP.NET programmatically) proclaimed that it couldn’t be done without using some screwy client-based redirection code.

Well, they were partially right: it does take some client-based code, but it, in my opinion, isn’t screwy or ghetto (as one person called it–whom I also pilfered the idea from). It is, in fact, pretty elegant and points to the raw power in ASP.NET.

Here’s the code:

public void ClearQueryStrings()
{
    string clientCommand = string.Format(
     
“document.all(\”{0}\”).action = \”{1}\”;”,
      this.Form.Name, Request.Url.Segments[Request.Url.Segments.Length - 1]);
    ClientScript.RegisterStartupScript(this.GetType(), “qr”, clientCommand, true);
}

Enjoy!


Copyright © 2007 No More ASP.NET. All rights reserved.