473,326 Members | 2,337 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,326 software developers and data experts.

401 Unauthorized trying to read SPList Attachment - owssrv.dll

We have written a class that enumerates the items in a WSS list and then
attemptes to open the attachment for each item. We have written two classes,
one to impersonate a user and read in the list information and the other to
be called by the first which actually opens the attachment. Our code fails
when it tries to open the attachment in the second class with a 401 -
Unauthorized error from IIS on http://localhost/_vti_bin/owssrv.dll. What's
strange is that I can use IE to open the URL to the attachemnt without any
problems. I noticed in the IIS logs that when I open the URL, I can see the
domain\password passed to IIS from IE. However, when our code tries to
access the same URL, no user information is passed, causing the 401. We have
impersonated a valid user in our code, so why does IIS not see it?

Thanks!
Nov 17 '05 #1
2 3798
Please do not post WSS programming questions in future to the main WSS
newsgroup but only to the newsgroup specially created for WSS programming
questions.

We are maintaining a clear split where WSS Programming questions go only to
microsoft.public.sharepoint.windowsservices.develo pment and not to the
(Administration issues) main newsgroup
microsoft.public.sharepoint.windowsservices.

This split is to the benefit of the readers of one or both these newsgroups.

Thanks.

Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please reply to the newsgroup

"Chris Kane" <Ch*******@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
We have written a class that enumerates the items in a WSS list and then
attemptes to open the attachment for each item. We have written two
classes,
one to impersonate a user and read in the list information and the other
to
be called by the first which actually opens the attachment. Our code
fails
when it tries to open the attachment in the second class with a 401 -
Unauthorized error from IIS on http://localhost/_vti_bin/owssrv.dll.
What's
strange is that I can use IE to open the URL to the attachemnt without any
problems. I noticed in the IIS logs that when I open the URL, I can see
the
domain\password passed to IIS from IE. However, when our code tries to
access the same URL, no user information is passed, causing the 401. We
have
impersonated a valid user in our code, so why does IIS not see it?

Thanks!

Nov 17 '05 #2
hi

i think the current context is associated with current logged in user
credentials so change the context.
string CurrentSiteUrl = SPControl.GetContextWeb(Context).Url;

start impersonation//username password etc

SPSite tmpSite = new SPSite(CurrentSiteUrl);
tmpSite.CatchAccessDeniedException = false;
SPWeb mysite= tmpSite.OpenWeb();

SPList lists=mysite.Lists["list name"];

undo impersonation

hope this helps

bart
"Mike Walsh" wrote:
Please do not post WSS programming questions in future to the main WSS
newsgroup but only to the newsgroup specially created for WSS programming
questions.

We are maintaining a clear split where WSS Programming questions go only to
microsoft.public.sharepoint.windowsservices.develo pment and not to the
(Administration issues) main newsgroup
microsoft.public.sharepoint.windowsservices.

This split is to the benefit of the readers of one or both these newsgroups.

Thanks.

Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please reply to the newsgroup

"Chris Kane" <Ch*******@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
We have written a class that enumerates the items in a WSS list and then
attemptes to open the attachment for each item. We have written two
classes,
one to impersonate a user and read in the list information and the other
to
be called by the first which actually opens the attachment. Our code
fails
when it tries to open the attachment in the second class with a 401 -
Unauthorized error from IIS on http://localhost/_vti_bin/owssrv.dll.
What's
strange is that I can use IE to open the URL to the attachemnt without any
problems. I noticed in the IIS logs that when I open the URL, I can see
the
domain\password passed to IIS from IE. However, when our code tries to
access the same URL, no user information is passed, causing the 401. We
have
impersonated a valid user in our code, so why does IIS not see it?

Thanks!


Nov 17 '05 #3

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

Similar topics

2
by: Jayakumar | last post by:
Hi, I am trying to convert a word document to pdf file from java for this, I am using a asp file to convert doc file to pdf. I got it working when I put the url which has file name as the query...
0
by: sirumalla | last post by:
These posting i have seen in so many sites but none of them solved the problem. Iam trying to fix this problem past 2 days but iam not able to do so. I doubt whether iam missing any peice of code ...
0
by: Jason | last post by:
I am trying to retrieve XML data from an ASP page. If I type the URL to the asp page into my browser (i.e. http://domain.com/getxml.asp) , I will get the xml displayed in IE. But, if I try to...
1
by: Dave | last post by:
I'm trying to make a webrequest to another server on our webfarm (to synch the cache as explained in http://www.eggheadcafe.com/articles/20030420.asp) but I'm getting a 401 unauthorized error. ...
2
by: ALI-R | last post by:
Hi All, I have a webservice on a win 2003 server and I'm trying to call it from another win2003 server which is hosting my sharepoint portal server. I am trying to call that webservice from a...
0
by: David Davis | last post by:
I am setting up some collaboration software called eProject for a client. eProject is a web based asp application. During setup, the instructions called for registering a service called...
5
by: Brent | last post by:
I'm trying to figure out a way to have JavaScript use getSelection() with text located in an iFrame. I've been able to make it work, but only when the iFrame displays a page located on the parent...
3
by: Newbie19 | last post by:
I created an xml page and put it on a web site and I'm trying to get an ASP.Net page to read the xml page using a vb script I came up with. when I ran the asp.net site, I got an error message...
1
by: jags | last post by:
HI All I was trying to create Document librray programatically in a Sharepoint Site and is not working for me.I was trying to implement this as an Event Handler. The aim of the code is to create...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
1
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...
1
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.