Andrew Stevenson's WebLog

Write Here Write Now

Syndication

.Net Languages

ADO.Net

Asp.Net (Misc.)

Asp.Net Controls

Bad Patterns

Err What?

Files and Folders

Forums

IE Add-Ins

Methods for the Madness

Performance

See Clearer, C#

Test Driven

September 2004 - Posts

Problems understanding MSIB UrlBuilder.

"Web site page navigation infrastructure. This physical component consists of the page navigation infrastructure. Site pages use the framework class UrlBuilder to construct links and to redirect to other pages. The UrlBuilder class methods ensure that any cookie information is carried over in the URL when cookies are disabled." http://www.microsoft.com/technet/itsolutions/techguide/mso/msib/msibarch.mspx

What does it mean? Is there a way to configure it?

I'm looking for the way to support Commerce Server's option to have the ticket in the url using the UrlBuilder. I might have a useable hack, but I'm hoping to find a right way.

 

 

 

Posted Friday, September 17, 2004 6:05 PM by AndrewSeven | with no comments

My site is gone, no more UITemplates.net from webmatrixhosting.net

I had a small site up on webmatrixhosting.net and now its gone, no more UITemplates.com /.net .

It was a great free/test host for my test site, but I will need a replacement sometime soon.

If you know of a good free host that supports a asp.net with a bin, please post it. I'm also looking for a reasonably good, low-priced host to re-build my dad's site on.

 

Posted Thursday, September 16, 2004 8:51 AM by AndrewSeven | 2 comment(s)

How to access the Web.Config and ProjectProperties at Design Time

You can use this in a design time context, where you have an ISite or annother ServiceProvider. I use a version with more properties in my designers.

DesignTimeConfig config = new DesignTimeConfig(this.Site);

Then use config.WebConfig to manipulate the XmlDocument...

using System;
using System.ComponentModel;
using System.ComponentModel.Design;

using System.Globalization;

using System.Resources;
using System.Xml;

using EnvDTE;


namespace UITemplates

 public class DesignTimeConfig
 {
  private XmlDocument _webConfig;
  private EnvDTE.ProjectItem _projectItem;
  private IServiceProvider _serviceProvider;

  public DesignTimeConfig(IServiceProvider serviceProvider)
  {
   _serviceProvider = serviceProvider;
  }
  public object GetService(Type type)
  {
   return _serviceProvider.GetService(type);
  }
  public XmlDocument WebConfig
  {
   get
   {
    string projectPath;
    string filename;
    if(_webConfig!=null)
     
    {
     return _webConfig;
    }

    XmlDocument configXml = new XmlDocument();
    projectPath = ProjectProperties.Item("ActiveFileSharePath").Value.ToString();
    filename = projectPath+ @"\web.config";
    configXml.Load(filename );
    _webConfig = configXml;
    return configXml;
   }
  
  }
  internal EnvDTE.Properties ProjectProperties
  {
   get
   {
    return ProjectItem.ContainingProject.Properties;
   }
  }
  internal EnvDTE.ProjectItem  ProjectItem
  {
   get
   {
    if(_projectItem==null)
    {
     _projectItem =(EnvDTE.ProjectItem)GetService(typeof(EnvDTE.ProjectItem));;    
    }
    return _projectItem;
   }
  }
  /// <summary>
  /// Gets the value from an <appSettings><add /> element
  /// </summary>
  /// <param name="key"></param>
  /// <returns></returns>
  public string AppSettings(string key)
  {
   XmlNode designLangNode = WebConfig.SelectSingleNode("//appSettings/add[@key='" + key + "']");
   if(designLangNode==null)
   {
    return String.Empty;
   }
   XmlAttribute currentValue = designLangNode.Attributes["value"];
   if(currentValue==null)
   {
    return String.Empty;
   }
   return currentValue.Value;
  }

public string GetProjectProperty(string name)
  {
   
   return ProjectProperties.Item(name).Value.ToString();
   
  }


 }
}

There is a posting here about it here, but as I commented, I prefer Site.GetService :
http://blogs.msdn.com/mszcool/archive/2004/06/30/169793.aspx

To get the project properties, you can call GetProjectProperty with the names from here : http://msdn.microsoft.com/library/en-us/vbcon/html/vbconthemacroprojectobjectmodel.asp?frame=true

Posted Wednesday, September 08, 2004 8:29 PM by AndrewSeven | 1 comment(s)

Filed under:

More Posts