0

I have created some custom WebParts on my SharePoint site through the use of SmartParts. My custom web parts look at 2 diff. SQL Server Datasources.

  • When i run my code from Visual Studio 2008 is works 100%
  • When i deploy my code on the SharePoint Page it works 100% when i run it from the server

But when i access the SharePoint site from my local PC and i hit that custom Webpart i get the error that say "403 FORBIDDEN". Now i know its a security problem but where and why? And why does it work on the SERVER and not from another PC??

Any help would be great!!

Edit:

MY ConnectionString in my Web.config

<add name="DSN" connectionString="Data Source=TCP:us-support.a1.mydomain.com;
   Initial Catalog=myDB;Integrated Security=false;User ID=myID;Password=myPassword"
   providerName="System.Data.SqlClient" />
0

1 Answer 1

1

There are two main reasons I can think of:

NTLM double-hop issue

This is probably the problem. Are you:

  • Using Windows authentication (NTLM) in your network and not Kerberos?
  • Using impersonation to connect to the databases? (True if your database connection string contains Integrated Security=SSPI or Trusted_Connection=True)

Then you are probably facing the double hop problem. This occurs because ASP.NET passes your Windows credentials to only one server, not two. So it will go from your local PC to the SharePoint server, but not be passed on to the database server.

The only way I know of to avoid this (unless you want to configure Kerberos) is set up a SQL account and use that in your connection string to the database.

Permissions to resources

The web part is accessing resources that your local PC account does not have permission to access.

Perform some sort of logging around the parts of your web part that you believe are causing the problem and narrow this down to a particular line of code. Note that while this may be a database authentication problem, it could also be that the web part is accessing some CSS file or other resource that your local account doesn't have permission to access.

4
  • Hi, please have a look at my Edit in my question. I have a SQL account set up.
    – Etienne
    Aug 17, 2009 at 12:34
  • Did you have a look at the second part of the answer? You need to narrow down to the particular line of code causing the error.
    – Alex Angas
    Aug 17, 2009 at 16:20
  • I have, but how would i go about this because i have full admin right on the server as well.
    – Etienne
    Aug 19, 2009 at 12:11
  • Use a debugger to step through the code until it fails. Or comment out the code until the 403 error no longer occurs.
    – Alex Angas
    Aug 19, 2009 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .