Error 1312 when Mapping drives.

T

Tomas Vera

Hello All,

I have a web application that is required to copy a file from the
WebServer to a remote web server (staging server to production
server).

I've created an application that maps the network drive, then moves a
specified file to the remote server. I've imported the SDK API
"WNetAddConnection2A" to map the network drive.

This work perfectly when I'm "Remoted" in to the staging server and
call my app from the command line. But my transfer app fails when
called from the Web App.

In my web app, I've tried creating a Process to start my app, and I've
tried importing my app directly into the web app and mapping the drive
directly from the web app.

In both cases, I'm getting a '1312' error ("A specified logon session
does not exist. It may already have been terminated.").

I need help in
1. Understanding what this error means,
2. Coming up with a solution to this issue.

Background:
This is a a C# app.
The command line app simply takes a filename as a parameter. A network
drive is mapped and the file is copied to the production server,
placed in the same locaton as the source file.

The command-line app uses a config file to read the remote server path
to be mapped, the desired drive letter, a username/password valid on
the remote machine). So the same values are used in the command line
app as in the we app.

Again, this works from the command line, but not from a web app.

I suspect that this is because the command line version is called when
I am logged in to the staging server as 'user' while the web app is
running as 'aspnet'. But I don't understand what the differece is
since the app is passing the username/password to the production
server when trying to map the drive.

All help is appreciated (greatly).

-tomas
/*-------------------------------
* Tomas Vera
* tomas (at) sbcglobal (dot) net
*-------------------------------
*/
 
R

Robert L [MS-MVP]

try to use domainname\username to mp. this link may help,

System Errors System error 1311 - There are currently no logon servers available to service the logon request System error 1312 has occurred - - A specified logon session ...
www.chicagotech.net/systemerrors.htm


Bob Lin, MS-MVP, MCSE & CNE
Networking, Internet, Routing, VPN Troubleshooting on http://www.ChicagoTech.net
How to Setup Windows, Network, VPN & Remote Access on http://www.HowToNetworking.com
Hello All,

I have a web application that is required to copy a file from the
WebServer to a remote web server (staging server to production
server).

I've created an application that maps the network drive, then moves a
specified file to the remote server. I've imported the SDK API
"WNetAddConnection2A" to map the network drive.

This work perfectly when I'm "Remoted" in to the staging server and
call my app from the command line. But my transfer app fails when
called from the Web App.

In my web app, I've tried creating a Process to start my app, and I've
tried importing my app directly into the web app and mapping the drive
directly from the web app.

In both cases, I'm getting a '1312' error ("A specified logon session
does not exist. It may already have been terminated.").

I need help in
1. Understanding what this error means,
2. Coming up with a solution to this issue.

Background:
This is a a C# app.
The command line app simply takes a filename as a parameter. A network
drive is mapped and the file is copied to the production server,
placed in the same locaton as the source file.

The command-line app uses a config file to read the remote server path
to be mapped, the desired drive letter, a username/password valid on
the remote machine). So the same values are used in the command line
app as in the we app.

Again, this works from the command line, but not from a web app.

I suspect that this is because the command line version is called when
I am logged in to the staging server as 'user' while the web app is
running as 'aspnet'. But I don't understand what the differece is
since the app is passing the username/password to the production
server when trying to map the drive.

All help is appreciated (greatly).

-tomas
/*-------------------------------
* Tomas Vera
* tomas (at) sbcglobal (dot) net
*-------------------------------
*/
 
W

Willy Denoyette [MVP]

You need to impersonate, aspnet is a local account which cannot be used to
access remote resources.
Please search "How To: Use Impersonation and Delegation in ASP.NET 2.0"
in msdn for more details.

Willy.

| Hello All,
|
| I have a web application that is required to copy a file from the
| WebServer to a remote web server (staging server to production
| server).
|
| I've created an application that maps the network drive, then moves a
| specified file to the remote server. I've imported the SDK API
| "WNetAddConnection2A" to map the network drive.
|
| This work perfectly when I'm "Remoted" in to the staging server and
| call my app from the command line. But my transfer app fails when
| called from the Web App.
|
| In my web app, I've tried creating a Process to start my app, and I've
| tried importing my app directly into the web app and mapping the drive
| directly from the web app.
|
| In both cases, I'm getting a '1312' error ("A specified logon session
| does not exist. It may already have been terminated.").
|
| I need help in
| 1. Understanding what this error means,
| 2. Coming up with a solution to this issue.
|
| Background:
| This is a a C# app.
| The command line app simply takes a filename as a parameter. A network
| drive is mapped and the file is copied to the production server,
| placed in the same locaton as the source file.
|
| The command-line app uses a config file to read the remote server path
| to be mapped, the desired drive letter, a username/password valid on
| the remote machine). So the same values are used in the command line
| app as in the we app.
|
| Again, this works from the command line, but not from a web app.
|
| I suspect that this is because the command line version is called when
| I am logged in to the staging server as 'user' while the web app is
| running as 'aspnet'. But I don't understand what the differece is
| since the app is passing the username/password to the production
| server when trying to map the drive.
|
| All help is appreciated (greatly).
|
| -tomas
| /*-------------------------------
| * Tomas Vera
| * tomas (at) sbcglobal (dot) net
| *-------------------------------
| */
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top