Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1102147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:08:27+00:00 2026-05-17T01:08:27+00:00

I need to call a web service to receive a JSON object which I’ll

  • 0

I need to call a web service to receive a JSON object which I’ll parse before rendering the content. Here’s the code for the same:

Dim jResponse As MessageResponseWrapper = New MessageResponseWrapper() 'Custom class to deserialize JSON
        Dim req As System.Net.HttpWebRequest
        req = System.Net.WebRequest.Create("http://some-cross-domain?q=" & SearchKeyword & "&restapi.response_style=view&xslt=json.xsl")
        req.Method = WebRequestMethods.Http.Get
        Dim res As HttpWebResponse = req.GetResponse()
        Dim reader As New StreamReader(res.GetResponseStream())
        Dim json As String = reader.ReadToEnd()

        Dim ser As New DataContractJsonSerializer(GetType(MessageResponseWrapper))
        Using ms As New MemoryStream(Encoding.Unicode.GetBytes(json))
            jResponse = TryCast(ser.ReadObject(ms), MessageResponseWrapper)
        End Using

This works as a stand alone ASP.Net page. However, I need this as a Web Part to port to a Sharepoint site. Using the method described here I’ve given the above code in the RenderControl() method. I get the error “The “CustomWebPart” Web Part appears to be causing a problem. Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.”

I have tried including variations of the following line in web.config with no avail.

<SafeControl Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Net" TypeName="WebPermission" Safe="True" AllowRemoteDesigner="True" />

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:08:28+00:00Added an answer on May 17, 2026 at 1:08 am

    Deploying the webpart to GAC worked.
    I was deploying it manually before – copy dll to bin folder

    Deploying to GAC give permissions to make calls like WebRequest.Create()

    Sharepoint Security references: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_sp2003_ta/html/sharepoint_wsscodeaccesssecurity.asp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to call a web service from javascript that returns a JSON array
I need to call a web service from jQuery, when I put the breakpoint
In an Activity, I need to call a web service every 30 seconds or
I have a synchronous web service call that returns a message. I need to
I have a WCF service that I need to call in a ASP.NET web
I need to call a web service from Javascript of a html page whose
I need to call Java web service from .Net application and that web service
I need to make multiple NSURLConnections to a JSON Web Service. I would like
Need to call web method, from web service. but name of method is unknown
I need to call web service from windows mobile at perticular interval. Is Timer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.