Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

webpart on GAC gives error!

  Asked By: Rolando    Date: Feb 20    Category: Sharepoint    Views: 1206

We have implemented a small application. For the simple webpart which
does not interact with database will gives correct output either by
placing dlls in bin directory or by placing on GAC.

For simle webpart:
* Bin folder can be removed from the SPS folder if it is placed in
GAC. and is available to all vertual servers.

Now same way We tried to create strong names for complex webpart.
Senario:
one web application displays list of data from database. We created it
as ascx file. We created and build with strong name keys. as a Next
step, We have added reference dll of the above application to webpart.
We created a strongname key also. We have loaded with the help of
"Page.LoadControl" method.

Finally we have placed both the "webpart dll" and "webapplication dll" in GAC.
Now We tried to add the webpart on the SPS page, it gives usual
error(not safe conrol error) as:

"An unexpected error has occurred.
Web Parts Maintenance Page: If you have permission, you can use this
page to temporarily disable Web Parts or remove personal settings. For
more information, contact your site administrator. "

Now again If we remove both the dlls from GAC and remove the snks from
both the webpart and web app project and rebuild, its nicely displays
the user control data which comes from database on SPS.

Can anybody help on this issue?

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Earl Craig     Answered On: Feb 20

I'm unclear on what you are asking. Can you ask a specific question?

 
Answer #2    Answered By: Ross Watkins     Answered On: Feb 20

We have created a webpart(without strong names) by placing all the
depedency dll in BIN folder.
Now we wanted to have our webpart  to be placed(options as bin or GAC)
on GAC. But our webpart refers 4-5 dependency dlls. That case how do
we place our webpart on GAC?.

At present when we placed on all the dependency dll on GAC, we are
facing ususal permission error. but if we remove the safecontrol from
web.config file, it works fine.

I understand If we place the webpart on GAC, even we can import on the
WSS site also? as its in GAC

 
Answer #3    Answered By: Jeremiah Wallace     Answered On: Feb 20

I hope that this helps:

You ask, "That case how do we place our webpart  on GAC?."
[Todd] The global install option of stsadm does not work properly. I
deploy the Web Part to the Virtual Directories that I want to use it on
and then drag and drop the Web Part DLL redundantly into the GAC. The
manual task of putting the redundant copy into the GAC must be done
after each deployment (not suggested for Web Part development).

You ask, "If we place the webpart on GAC, even we can import on the WSS
site also?"
[Todd] I think it is required. I haven't successfully used a DLL in the
GAC without that DLL also in the bin. I know it isn't supposed to be
that way but that is the reality as I've experienced it.

Why do you want your Web Part DLL in the GAC? The /bin is the
recommended place for Web Part DLLs. You may also want to look into
using a privatePath in the web.config.

 
Answer #4    Answered By: Tony Freeman     Answered On: Feb 20

I have a question agiain on webpart.. I placed all the
dependency dlls and webpart  dlls on GAC. afterthat I am getting usual
permission error!  But when I place all dlls in bin folder works fine.
What is the problem after placing dlls on GAC. I have made a custom
policy file. and assign level="MyCustom"

Can you just give your ideas?

 
Answer #5    Answered By: Danny Shaw     Answered On: Feb 20

Odd. What is the permission error?

What if you assign level="Full" rather than your MyCustom value?

 
Answer #6    Answered By: Benjamin Wright     Answered On: Feb 20

By adding trustlevel="full", only once it was displayed.(very
first time) after changing th trustlevel=mycustom again I changed to
full, its giving error!  Is this part is not feasible?

I have removed/empty from the cashe also. still gives error.

 
Didn't find what you were looking for? Find more on webpart on GAC gives error! Or get search suggestion and latest updates.




Tagged: