Monday, March 26, 2012

Map network drive / file access

Guys,

I am trying to open an excel template from an ASP page. I have identity impersonate set to true in web.config, the file I am trying to access is in the root folder of my website, and all users have access.

When I try to open this file I am being asked for a logon, I want to get rid of this so it is seamless to the user.

I was thinking, if there was a way of mapping a network drive on the server, with predefined account credentials, then I could access the file in code using "wkbk = xl.Workbooks.Open("z:\HPTResults.xlt")" rather then giving the full unc path ? Could that get round my login problem ?

Thanks
BobAlthough I think my post in your other thread should eliminate this question, you could have a look at the NetworkCredentials class, but I am not 100% sure how this method would apply in this case.

Yet another option you can look at is to have a local copy of the XLS file on your server and then write the file in a stream to the user.
MH, could you give me some more info about the writing to a stream please mate, as that sounds like a good option.

Cheers
Bob
Try out what I've posted in your other thread.

What is "MH"?
Sorry . . . mh, mendhak . . . MendHak . . .

I'll try the jscript and let you know later.

Cheers
Ah, ok... I thought it was an odd variation of m8. :)

0 comments:

Post a Comment