473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Setting default page in deployment

QDL
Hello everyone,

is there a way to programmatically set the default document from a
deployment project for ASP.NET. My default page is named default.htm and I'd
like to set it as the topmost default document in IIS site properties using
the deployment project, is this possible? Tried to google but found no
answer.

TIA
Paolo
Oct 31 '06 #1
3 1438
You can do this by exporting the IIS settings and actually installing them
on the server in question. I do not have a working example right now, but
will see if I have anything written up on it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"QDL" <qd*@qdl.qdlwrote in message
news:45***********************@reader3.news.tin.it ...
Hello everyone,

is there a way to programmatically set the default document from a
deployment project for ASP.NET. My default page is named default.htm and
I'd like to set it as the topmost default document in IIS site properties
using the deployment project, is this possible? Tried to google but found
no answer.

TIA
Paolo


Oct 31 '06 #2
QDL
You can do this by exporting the IIS settings and actually installing them
on the server in question. I do not have a working example right now, but
will see if I have anything written up on it.
Thanx Cowboy for answering, will appreciate if you have a sample but anyway,
you pointed me the right way... I thought there was something in the
Deployment project to obtain that but I was wrong...

Thanx
Paolo
Oct 31 '06 #3
QDL
I answer myself as I found the way and may be helpful to some1:

1. In deployment project add CustomAction for OnCommit specify
InstallerClass=True and add parameter /vdir="[TARGETVDIR]"

2. Add an installer class to your aspnet project and insert this override:

Private Const EnableDefaultDoc = &H40000000&

Protected Overrides Sub OnCommitted(ByVal savedState As
System.Collections.IDictionary)
Dim folderRoot, vdir As DirectoryEntry
Dim vdirname As String

Try
vdirname = Me.Context.Parameters("vdir")

folderRoot = New DirectoryEntry("IIS://localhost/W3SVC/1/Root")
folderRoot.RefreshCache()

vdir = folderRoot.Children.Find(vdirname, folderRoot.SchemaClassName)

vdir.Properties("DirBrowseFlags").Value =
vdir.Properties("DirBrowseFlags").Value Or EnableDefaultDoc
vdir.Properties("DefaultDoc").Value = "default.htm"

vdir.CommitChanges()
folderRoot.CommitChanges()
Catch ex As Exception
Finally
If (Not vdir Is Nothing) Then
vdir.Close()
End If

If (Not folderRoot Is Nothing) Then
folderRoot.Close()
End If
End Try
End Sub

This will enable default documents and add default.htm as the only default
document. Of course can be changed.

Hope someone will be helped by this

Paolo
Oct 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: fleemo17 | last post by:
My organization is developing a set of "standards" for websites built inhouse. The first question that comes to mind is what would be a good standard default size for <p> text? 12 point? Which...
0
by: Joe S | last post by:
Is there a way in a deployment project to set the default values for textboxes that will be displayed in a User Interface dialog? Specifically, I want to be able to get a look at the environment...
1
by: CES | last post by:
All, Could someone please point me to a step by step resource on setting up a ..net Web Application on IIS. I'm having a problem setting up IIS to except a new Web Application. I'm deploying...
10
by: johndoe | last post by:
While creating a shopping cart application I noticed a strange bug which resulted in the Constructor and everything being called twice. I was using Inherited classes ClassShowProducts inherited...
4
by: VB Programmer | last post by:
When I set intro.aspx as the "start page" for my ASP.NET project it works perfectly in Visual Studio.net. When I use IE and open up the website in localhost (http://localhost/MySite/) it uses...
2
by: junlia | last post by:
Hi All, I am working on a project that acts as a bridge. It does some checking with post xml data, and then redirects the request to an appropriate page. However, we find that depends on the...
0
by: willem joubert | last post by:
I got the following message from Microsoft Web Hosting Customer Support ===================================================== The only file that we see located within the /web directory of your...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
6
by: WT | last post by:
Hello, I am searching for a way to generate automatically from codebehind the <!Doctype....for asp.net pages using .net 3.5 c# and vs2008. Subidiary question: if I do a server transfert in my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.