Hi,
I've recently inherited an ASP.NET website. I have moved the site over to a new server and am now having a problem I'd like some help debugging. I'm a new to .NET development but am familiar with other languages so would like to try correcting this myself. The server is a Windows Server running ASP .NET 3.5.

Link to website: http://vermadesign.co.uk/?f

On the porfolio section, when viewing a portfolio or image, the following error message appears:

Error: System.Security.Permissions.SecurityPermission
encryted string 4C90089616F0449712C31DA052B6B2F782CDADF85DE53B74ECE8CDC0AB71CC362AA85174C8AA5C7B36A7DCD8B8EF4B036244D36CEE5DE90CECB371EBDB

I understand that this is caused by security permissions on the server, however, as I'm using a shared host, I am not able to alter these settings so am looking to amend the code instead. My first question is, will I need any form of source code? i.e. do you need you compile .NET code before you can deploy an application?
I've identified that this is caused by a a key set in the web.config as follows:

<appSettings>
    <add key="website_name" value="4C90089616F0449712C31DA052B6B2F782CDADF85DE53B74EC  E8CDC0AB71CC362AA85174C8AA5C7B36A7DCD8B8EF4B036244  D36CEE5DE90CECB371EBDB" />
  </appSettings>

When I remove the key and switch on error reporting, I get the following stack trace

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   postcard.postcard._IsPostCard() +98
   postcard.postcard..ctor(Int32 page_id) +174
   postcard.postcard_gallery.Page_PreInit(Object sender, EventArgs e) +286
   System.Web.Util.CalliHelper.EventArgFunctionCaller  (IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Cal  lback(Object sender, EventArgs e) +35
   System.Web.UI.Page.OnPreInit(EventArgs e) +8698174
   System.Web.UI.Page.PerformPreInit() +31
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

My question is, how do I find out where the IsPostCard() function is declared. As the gallery is working fine despite this error, I was hoping to amend the script and remove the reference to the key so the error doesn't appear.

I need to find out what file the IsPostCard() function is in and also what file the postcard namespace is defined.

Apologies if these are really simple questions but this is all new to me and I'd very much like to learn.

Kind regards

Dev

My first question is, will I need any form of source code? i.e. do you need you compile .NET code before you can deploy an application?

Yes and no, you do need the sourcecode for recompilation. And also in order to fix the second question.
However, you don't need the sourcecode if you know that everything will work precompiled out-of-the-box.

My question is, how do I find out where the IsPostCard() function is declared. As the gallery is working fine despite this error, I was hoping to amend the script and remove the reference to the key so the error doesn't appear.

I need to find out what file the IsPostCard() function is in and also what file the postcard namespace is defined.

See first answer.
Look for any references for the saught method in the codebehind file of the page where the error occurs.
If, at first glance, you cannot find the method. Load the project in debug mode from Visual Studio, or whatever development tool you're using, and set a breakpoint either on the Page_Load event or somewhere before you think the IsPostCard() method is called.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.