creating website programmatically using C#

Discussion in 'ASP General' started by Mandar, Sep 9, 2008.

  1. Mandar

    Mandar Guest

    Hi,

    I have written some code in C# to programmatically create a website
    and an application pool. Both seems to be getting created alright with
    whatever settings I have applied. However, when I fire a request to
    the website, I get a "page can not be displayed" message". I get
    nothing in the event viewer logs. I read somewhere that from website
    properties > Home Directory > Application Settings, if I remove and
    recreate the application pool, website starts serving requests. This
    DOES work but I am unable to figure out how to accomplish this from my
    code. When I checked Metabase.XML file of IIS before and after doing
    this change manually, only change I noticed that following gets added
    inside <IIsWebVirtualDir>.

    UNCPassword="49634462500000000600000040000000bd77b5e56b3f000048866b15ac840f0bc531565bfc2a1b5c6eb77c9661f527ba8edd7344f93776e7cf6ae118bcdb8db8a6ea143d7ae1d03c8672ac2c84bd677cd3fde3c37cf6e6a0"

    However, my app pool is running under "local system" identity. So this
    string might correspond to some default encrypted string.

    Does anyone know how to get it working from my code?

    Thanks,
    Mandar
    Mandar, Sep 9, 2008
    #1
    1. Advertising

  2. Mandar

    Marc Gravell Guest

    I don't know what the error is - however, running a web-site as "local
    system" seems very, very dangerous... is there any good reason it
    needs that level of power? "least priveleged", 'n all...

    Marc
    Marc Gravell, Sep 9, 2008
    #2
    1. Advertising

  3. Mandar

    G.S. Guest

    On Sep 9, 8:33 am, Mandar <> wrote:
    > Hi,
    >
    > I have written some code in C# to programmatically create a website
    > and an application pool. Both seems to be getting created alright with
    > whatever settings I have applied. However, when I fire a request to
    > the website, I get a "page can not be displayed" message". I get
    > nothing in the event viewer logs. I read somewhere that from website
    > properties > Home Directory > Application Settings, if I remove and
    > recreate the application pool, website starts serving requests. This
    > DOES work but I am unable to figure out how to accomplish this from my
    > code. When I checked Metabase.XML file of IIS before and after doing
    > this change manually, only change I noticed that following gets added
    > inside <IIsWebVirtualDir>.
    >
    > UNCPassword="49634462500000000600000040000000bd77b5e56b3f000048866b15ac840f­0bc531565bfc2a1b5c6eb77c9661f527ba8edd7344f93776e7cf6ae118bcdb8db8a6ea143d7­ae1d03c8672ac2c84bd677cd3fde3c37cf6e6a0"
    >
    > However, my app pool is running under "local system" identity. So this
    > string might correspond to some default encrypted string.
    >
    > Does anyone know how to get it working from my code?
    >
    > Thanks,
    > Mandar


    Most likely the "page can not be displayed" has error number... 500
    being "Server Error" may contain additional information - the strings
    IE displays under "Technical Information" on 500 errors. You could try
    to reproduce the error inside IE.

    Or it could be a 403

    or even "page not found"
    G.S., Sep 9, 2008
    #3
  4. Mandar wrote:
    > Hi,
    >
    > I have written some code in C# to programmatically create a website


    this has nothing to do with classic COM-based ASP
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 9, 2008
    #4
  5. Mandar

    Mandar Guest

    >>> this has nothing to do with classic COM-based ASP
    @Bob - Am I not supposed to ask this query on this group? I am a bit
    confused. My query is more related to IIS than it has do with C#. So
    chose to write on this group.

    >>> You could try to reproduce the error inside IE.

    @G.S. - In IE I get the following -

    <snip>
    More information

    This problem can be caused by a variety of issues, including:

    Internet connectivity has been lost.
    The website is temporarily unavailable.
    The Domain Name Server (DNS) is not reachable.
    The Domain Name Server (DNS) does not have a listing for the website's
    domain.
    If this is an HTTPS (secure) address, click tools, click Internet
    Options, click Advanced, and check to be sure the SSL and TLS
    protocols are enabled under the security section.
    </snip>

    But I dont think any of this holds true for me.

    >>> running a web-site as "local system" seems very, very dangerous...


    @Marc - I am writing an installer where I need to create a web site
    and provide user with possible identity options as - Local System and
    User Configurable. Thats not my issue here.

    The fact that I can make the website working by just recreating the
    application under the website leads me to believe that I have done
    something wrong in my code or something is missing that should be
    there. Any pointers?

    Thanks,
    Mandar
    Mandar, Sep 10, 2008
    #5
  6. Mandar wrote:
    >>>> this has nothing to do with classic COM-based ASP

    > @Bob - Am I not supposed to ask this query on this group?


    It's not a question of "supposed" - it's a question of posting your
    question in a place where you will most likely find the people to help
    you. I'm not trying to be a net cop - I'm just trying to make sure you
    find your answer as quickly as possible.

    > I am a bit
    > confused. My query is more related to IIS than it has do with C#. So
    > chose to write on this group.


    This group deals with COM-based ASP questions, not IIS or C# questions.
    Sometimes an IIS question will get an answer here, but you can be better
    assured of reaching the proper audience at .inetserver.iis if the .Net
    people can't answer it.

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
    Bob Barrows [MVP], Sep 10, 2008
    #6
  7. Mandar

    Mandar Guest

    @Bob - thanks for the clarifications. I am a bit new to these group
    ethics stuff. Am really stuck at this point and want an answer asap.
    So decided to write on a few related group. Sad that this group is not
    a right place. Thanks again. I will try posting this on inetserver.iis.
    Mandar, Sep 10, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bXNseWg=?=

    Programmatically creating pages

    =?Utf-8?B?bXNseWg=?=, Feb 15, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    7,639
    =?Utf-8?B?bXNseWg=?=
    Feb 17, 2004
  2. Raoul Snyman
    Replies:
    14
    Views:
    11,097
    Curt_C [MVP]
    Apr 29, 2004
  3. RJN
    Replies:
    1
    Views:
    2,194
    Girish Bharadwaj
    Oct 12, 2004
  4. Luis Esteban Valencia

    Programmatically creating template columns for datagrid

    Luis Esteban Valencia, Jan 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    647
    Saravana
    Jan 11, 2005
  5. tho_mica_l
    Replies:
    7
    Views:
    115
    Charles Oliver Nutter
    Jan 7, 2008
Loading...

Share This Page