Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

DB Connection and Debugging in Virtual Directory

  Asked By: Griffin    Date: Jul 01    Category: Sharepoint    Views: 1323

I am trying to create a user control web part. Here is what I did:

1. Create a Virtual Directory
2. Exclude the Virtual Directory using Managed Path
3. Create a test Page using Visual Studio.
4. Removed Global.asax and web.config files

Here is the problem that I have:

I can not debug the testing page,WebForm1.aspx. When I click on
DebugStart (F5), I get this error: "Debugging is not supported under
current trust level settings." But if I right click to view in the
browser, it works. Is there a way to make debug work? Or I have
something wrong.

When I added database connection to the page, it gives me this

** Start Error **

Server Error in '/UserControls' Application.

Runtime Error
Description: An application error occurred on the server. The
custom error settings for this application prevent the details of
application error from being viewed.

Details: To enable the details of this specific error message to be
viewable on the local server machine, please create a <customErrors>
tag within a "web.config" configuration file located in the root
directory of the current web application. This <customErrors> tag
should then have its "mode" attribute set to "RemoteOnly". To enable
the details to be viewable on remote machines, please set "mode"
to "Off".

<!-- Web.Config Configuration File -->

<customErrors mode="RemoteOnly"/>

Notes: The current error page you are seeing can be replaced by a
custom error page by modifying the "defaultRedirect" attribute of
application's <customErrors> configuration tag to point to a custom
error page URL.

<!-- Web.Config Configuration File -->

<customErrors mode="On" defaultRedirect="mycustompage.htm"/>

** End Error ***



4 Answers Found

Answer #1    Answered By: M Juarez     Answered On: Jul 01

First, change the web.config file  in the root of your SharePoint site
<customErrors mode="On"/>

<customErrors mode="RemoteOnly"/>

Second, change the trust  level (also at the bottom of the web.config
file in the root of your SharePoint site) from:
<trust level="WSS_Minimal" originUrl="" />

<trust level="Full" originUrl="" />

for testing.

Refresh the page  and let us know what happens.

Answer #2    Answered By: Marty Mcdowell     Answered On: Jul 01

Beware, you do not want to be running your production SharePoint sites
under "Full" trust. So, only do this on your development environment.

Answer #3    Answered By: Dakota Shaffer     Answered On: Jul 01

I have some additional question:

When I build the cab file, the UserControl.dll goes to the
VirtualServer/UserControl/bin directory. Then I copy it from the
VirtualServer/UserControl/bin to the VirtualServer/bin manually. I
tried to specify the output path of the UserControl project to the
VirtualServer/bin and it gives me an error  that "Output path must
under the project folder."

Am I doing it correctly?

I think I heard you or some other people from the class
mentioning "Smart Part" in the class but I can not remember anything
else. I did some search from the web  and it sounds like a good tool
to build a UserControl WebPart. Have you used this tool? Would you
recommand using this tool?


Answer #4    Answered By: Ted Gilmore     Answered On: Jul 01

I know most like the Smart part  and it's a great starting place. But, I
don't like it because I can't imbed the ASCX as part of the deployable
Web component. It only takes a few lines of code to replicate it's
functionality so I don't see the point.

Didn't find what you were looking for? Find more on DB Connection and Debugging in Virtual Directory Or get search suggestion and latest updates.