Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0value cannot be null. parameter name: virtualPath value cannot be null. parameter name: virtualPath
Previous
 
Next
New Post
6/11/2007 10:26 AM
 

Hi I am a developer that is relatively new to .net and developing in DNN.  I have a module that I have been working on that implements .net AJAX 1.0 and the toolkit.  The module also uses a lot of nested .ascx controls for various functionality and they are switched out as needed.  At the moment my biggest problems is that every once in a while when a postback occurs I get the error:

value cannot be null. parameter name: virtualPath

This seems to be almost random, it happens on different .ascx controls and at different times.  Any thoughts or ideas as to what potential causes may be would be appreciated.

Thanks!

 
New Post
6/11/2007 1:16 PM
 

Can you look in the Log Viewer under the Admin menu to find the stack trace for that error?  That would probably help a lot, to know which method, specifically, is c ausing the error, and which of your methods is calling it.


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
6/11/2007 3:11 PM
 

Thank you for the response. I have posted my event log of an occurrence below, with some site specific information edited out.  When the module loads up, I call a subroutine that loads the appropriate control based on a session variable.  The modules access is restricted to logged in users, so if their session expires they are redirected to login.

AssemblyVersion: 04.05.01
PortalID: 0
PortalName: *Edited

UserID: 94
UserName: *Edited

ActiveTabID: 97
ActiveTabName: Tech Support
RawURL: /Support/TechSupport/tabid/97/Default.aspx
AbsoluteURL: /Default.aspx
AbsoluteURLReferrer: https://*Edited/Support/TechSupport/tabid/97/Default.aspx
UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: 1ad3d67f-e17c-4aff-941d-43c3150d423a
InnerException: Value cannot be null. Parameter name: virtualPath
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Web.VirtualPath.Create
StackTrace:
Message: DotNetNuke.Services.Exceptions.PageLoadException: Value cannot be null. Parameter name: virtualPath ---> System.ArgumentNullException: Value cannot be null. Parameter name: virtualPath at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at SBS_DNN_AJAXSupportDeskl.addSubControl() at SBS_DNN_AJAXSupportDeskl.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
Source:
Server Name: WEBPRODUCTION1

Below is my code for loading the subcontrol in the module, again I am kind of new to this and I really appreciate you taking a look.

The AppRelativeVirtualPath="~/" thing has to do with some blogs that I read where people encountered similar issues, it has not fixed my issue.

  Sub addSubControl()Me.AppRelativeVirtualPath = "~/"

 

'testing for session failure

 

If Session(SDMode) = "" Or Session(SDMode) = Nothing Then

Session(SDMode) =

"TicketView"

 

End If

 

'this variable is for part of the path to the control, to allow for easy switching between the test and dnn environment

 

'just uncomment one line to switch

 

Dim strEnvPath As String

 

'strEnvPath = "~\"

strEnvPath =

 

 

"~\DesktopModules\SBS_DNN_AJAXSupportDesk\"

 

Dim ctlPath As String = ""

 

 

Select Case Session(SDMode)Case "TicketView"

ctlPath = strEnvPath &

"TicketView.ascx"

 

Case "UpdateTicket"

ctlPath = strEnvPath &

"UpdateTicket.ascx"

 

Case "AddTicket"

ctlPath = strEnvPath &

"AddTicket.ascx"

 

Case "AddCompleted"

ctlPath = strEnvPath &

"AddCompleted.ascx"

 

 

 

 

End Select

 

'Creates a control object, assigns it to the control we want and then loads it into the

 

'PlaceHolder.

controlToLoad =

 

Me.LoadControl(ctlPath)'We must assign a new id when switching controls

controlToLoad.ID = Session(SDMode)

phMainWindow.Controls.Clear()

controlToLoad.EnableViewState =

True

phMainWindow.Controls.Add(controlToLoad)

 

End Sub

Private

 

 
New Post
6/11/2007 5:25 PM
 

The error message seems to be saying that your call to LoadControl sends an empty string.  Instead of (or in addition to) using If Session(SDMode) = "" Or Session(SDMode) = Nothing Then Session(SDMode) ="TicketView", you should set a default case in your select case statement, so that you can make sure that nothing gets through.  The only other small thing that I notice is the direction of your slashes strEnvPath, I would use backslashes. I can't see any other gaping holes here, if that doesn't fix it, you can put a Debug.Assert statement right before the LoadControl statement to make sure that ctlPath isn't empty or nothing, and then you can monitor the debug output whenever it happens, and check the state of Session(SDMode), and anything else that might be problematic.


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
6/12/2007 10:12 AM
 

Thank you!

Before I wrote the reply to you I had not been aware of the event viewer within DNN, it makes debugging considerably easier.   The issue definitely appears to be a loss of session. I will add the changes you have recommended and maybe even consider viewstating the one variable.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0value cannot be null. parameter name: virtualPath value cannot be null. parameter name: virtualPath


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out