다음을 통해 공유


VSSDatabase.Open via ASP.NET

A customer
recently sent me the following code, which uses VSS automation to open a
SourceSafe database via an ASP.NET page. He was running IIS locally
against a remote VSS server and, upon running the code got the
following error message: ”The
SourceSafe database path Guest does not exist. Please select another
database.”

<%@ Import Namespace="SourceSafeTypeLib" %>
<html>
  <head>

<title>Testing VSS Automation with
ASP.NET</title></head>
  <body>
    <script
language="C#" runat=server>

VSSDatabase db =
new VSSDatabase();

void Page_Init (Object oSender, EventArgs
oEvent)
 {
  string path = @\\vsufile\vsstest\srcsafe.ini;
  string user
= "Admin";
  string pass = "*pass!1wor2t";

db.Open(path, user, pass);
 }

    </script>
  </body>
</html>

Issue
Description and Workaround

This error message appears
when VSS is unable to locate or gain access to a srcsafe.ini
file. To work around this issue, one must grant permission to the ASPNET
user for the \\vsufile share or allow IIS
impersonation on the Web server. The appearance of "Guest"
in the error message is a known issue. Apparently, the 'user' and 'path'
variables got transposed in the code.

This
posting is provided "AS IS" with no warranties, and confers no rights.
Microsoft kann für die Richtigkeit und Vollständigkeit der Inhalte in dieser
Newsgroup keine Haftung übernehmen.
Este mensaje se proporciona "como está"
sin garantías de ninguna clase, y no otorga ningún
derecho.

Comments

  • Anonymous
    October 15, 2003
    The comment has been removed

  • Anonymous
    October 29, 2003
    I'm having the exact the same problem.... Please tell me if you solve the problem..

  • Anonymous
    March 02, 2004
    I'm having the exact same problem, not a permission issue... Please let me know what the solution is... Thanks...

  • Anonymous
    May 04, 2004
    Using the sourcesafetypelib via COM Interop in .NET don't seem to work all that great. try mixing up the order of the 3 parameters of the VSSDatabase.Open method. If you do it right, it says can't find database <user>, if you put the <user> and <password> first it says it doesn't have access, if you put the <user>, <ini file>, then <password> you get a "Cannont open <ini file> error. The error messages you see just don't make any sense at all. I've heard there might be a bug in the way they are transposed, but me don't no nothing about no "transposing". No just know "noworkie". Oh well, I guess that's what VB6 is for, huh.

  • Anonymous
    June 18, 2004
    Has anyone found a solution to this issue? I am fighting with it aswell :-/

  • Anonymous
    June 21, 2004
    I think it is a permission issue. Run this code below as an ASP.NET page and then a Console application.
    --------------
    using SourceSafeTypeLib;

    VSSDatabaseClass objVSSDB = new VSSDatabaseClasss();
    objVSSDB.Open("PathToSRCSAFE", "validUser", "validPass");
    --------------

    Personally when run as Console app I had no problems connecting to VSS but if run as an ASP.NET app I failed w/ an error saying that "validUser in not a valid user ... please use different database"

  • Anonymous
    June 21, 2004
    One more observation. When I run previously presented code as an ASP.NET application on the web server where the VSS server was located I successfuly connected and retrieved files from VSS. So, IIS and VSS servers have to be on the same machine for things to work. BYW, I have also added ASPNET account to these who can access and modify VSS directory where srcsafe.ini is included.

  • Anonymous
    June 25, 2004
    I believe that I have found one somewhat insecure way around this. By default the ASPNET_WP runs under the ASPNET user which is more restricted then running as a system account. If you modify your machine.config file, and set the processModel in the
    <System.Web>
    <processModel />
    to use either SYSTEM or a domain account, this problem goes away, and no further changes are required to the locations where the vss files are stored.

  • Anonymous
    July 12, 2004
    this may be the stupid way, but try declaring the database as an IVSSDatabase, a la:

    SourceSafeTypeLib.IVSSDatabase db2 = new VSSDatabaseClass();
    db2.Open(@"\pathsrcsafe.ini", "username","pass");

    that seems to work for me, at least

  • Anonymous
    July 05, 2005
    this may be the stupid way, but try declaring the database as an IVSSDatabase, a la:

    SourceSafeTypeLib.IVSSDatabase db2 = new VSSDatabaseClass();
    db2.Open(@"\pathsrcsafe.ini", "username","pass");

    that seems to work for me, at least
    ============================================

    I am writing ASP.NET in VB.net, I failed to find New() method for neither IVSSDatabase nor IVSSDatabaseOld. I have no idea how Jesse get it work.

    I also try to get the srcsafe.ini file to local machine and change the "The two important paths used by SourceSafe" -- Data_Path & Temp_Path to point to the server's path with \servervss..(etc.). And I modified the Users_Txt option of the local-copied srcsafe.ini. Then I try to point to the local-copied srcsafe.ini file. I got the following error message:"
    System.Runtime.InteropServices.COMException: Visual SourceSafe database \servervssdata does not exist. Please select another database.”

    I am still tring. If anybody have development, tell me :(
    longmain@hotmail.com

  • Anonymous
    August 30, 2005
    If you're doing this like I was, you were attempting to use the VSS com object via com interop. With impersonation on (in web.config), I could:

    1) Read/write files on my web server from my code. (No problem)
    2) with impersonation/delegation, read/write files on a file share from my code.
    3) Have the VSS COM object manipulate a VSS database on my web server.
    What I could not do, was
    4) Have the VSS COM object manipulate a VSS database on some file share.

    Impersonation was NOT extended to the COM object. It worked in my code, though. From looking at security logs, it looks like the vss object was trying to log in as IUSR or some account local to the web server -- not a domain account, and definitely not my impersonated account.

    I found a solution here:
    http://www.dmbcllc.com/server.aspx
    I don't know how it works, but apparently if you create a com+ application on your web server, you can give it any domain login you like, and that login will be impersonated/delegated to any VSS server. This fits my requirement ok for now.

    -J

  • Anonymous
    October 08, 2005
    http://www.siteexperts.com/forums/viewConverse.asp?d_id=15214&Sort=0

    i try this:
    <identity impersonate=true userName=Domainnamenetworkuserlogin password=trustme />

    but no use~

  • Anonymous
    October 08, 2005
    http://www.siteexperts.com/forums/viewConverse.asp?d_id=15214&Sort=0

    i try this:
    <identity impersonate=true userName=Domainnamenetworkuserlogin password=trustme />

    but no use~

  • Anonymous
    April 05, 2006
    I used the following:

    string path = "c:websitevsssrcsafe.ini";

    that being the location on the server that the aspx pages are loaded, then in that srcsafe.ini file i had the following

    #include \serversharesrcsafe.ini

    that worked a treat for me.

  • Anonymous
    June 22, 2006
    I tried the #include suggested... I don't know if I goofed something up, but it did not work.

  • Anonymous
    August 25, 2006
    Very informative post about <a href="http://approvalcredit.bravehost.com/health-insurance-international.html"">http://approvalcredit.bravehost.com/health-insurance-international.html" title="health insurance international">health insurance international</a> and [URL=http://approvalcredit.bravehost.com/health-insurance-international.html]health insurance international[/URL]

  • Anonymous
    August 26, 2006
    I am so lucky on [url=http://2access.2surf.eu]having[/url] what I have! And good luck in yours [url=http://access.122mb.com]search[/url].
    Just visit [url=http://access.2surf.eu]my site[/url].








  • Anonymous
    August 31, 2006
    Very interesting and good point about <a href="http://freeinsurance.250free.com/instant-insurance-life-quote.html"">http://freeinsurance.250free.com/instant-insurance-life-quote.html" title="instant insurance life quote">instant insurance life quote</a> and [URL=http://freeinsurance.250free.com/instant-insurance-life-quote.html]instant insurance life quote[/URL]

  • Anonymous
    September 06, 2006
    Thank you so much for this great post  about <a href="http://freecarhire.bravehost.com/play-card-games-online.html"">http://freecarhire.bravehost.com/play-card-games-online.html" title="play card games online">play card games online</a> and [URL=http://freecarhire.bravehost.com/play-card-games-online.html]play card games online[/URL]

  • Anonymous
    September 07, 2006
    Very informative post about <a href="http://debtoff.50megs.com/bad-credit-unsecured-loan.html"">http://debtoff.50megs.com/bad-credit-unsecured-loan.html" title="bad credit unsecured loan">bad credit unsecured loan</a> and [URL=http://debtoff.50megs.com/bad-credit-unsecured-loan.html]bad credit unsecured loan[/URL]

  • Anonymous
    September 16, 2006
    I am so [url=http://access.2surf.eu]lucky[/url] on having what I have! And good luck in yours [url=http://2access.2surf.eu]search[/url].
    Just visit [url=http://access.122mb.com]my site[/url].









  • Anonymous
    April 13, 2008
    PingBack from http://superpatrick.wordpress.com/2008/04/14/sourcesafe-automation-bug/

  • Anonymous
    June 09, 2009
    PingBack from http://weakbladder.info/story.php?id=3757

  • Anonymous
    June 19, 2009
    PingBack from http://mydebtconsolidator.info/story.php?id=17922