Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

System.Data.SqlClient.SqlException: Procedure or function 'wp_session_spLogout' expects parameter '@SessionKey', which was not supplied.

I have a stored procedure that is throwing a web error whenever a user is logged in and the system times out . I am attaching my stored procedure and the web error log to this question. What do I need to include in my stored procedure to eliminate this web error from appearing on a daily basis?
wp-session-spLogout.docx
web-error.docx
0
is_staff
Asked:
is_staff
  • 6
  • 2
1 Solution
 
venk_rCommented:
From the exception that you attached looks like the sessionkey value isn't been passed at times and it throws the error.


System.Data.SqlClient.SqlException: Procedure or function 'wp_session_spLogout' expects parameter '@SessionKey', which was not supplied
0
 
is_staffAuthor Commented:
This is true. I am wondering why this is happening and how can I prevent this from happening. This error has some connection with the files below. Any ideas?  Thank you.
TimeOut2.aspx
TimeOut2.aspx.cs
0
 
esolveCommented:
This error is being generated by your web app and has nothing to do with the proc. So whenever this code runs on your website for whatever reason the actual parameter has not been set.

You will have to modify your webmethod to ensure the parameter is being passed to the proc always.

You can update your proc to allow for default values like below but I don't think this will solve your problem. You will still have to ensure that your code in your web method does always include the parameter which for some reason is not.

ALTER   PROCEDURE [dbo].[wp_session_spLogout]
      @SessionKey      VARCHAR(64) = ''
AS

if(@SessionKey = '') BEGIN SET @SessionKey = NULL END

if(@SessionKey IS NOT NULL)
BEGIN
 'do updates etc.
END
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
is_staffAuthor Commented:
Do you think it has anything to do with the API call being used?
0
 
esolveCommented:
Do you have the code for the API call? My guess is that the API call passes a null to the procedure.
0
 
is_staffAuthor Commented:
The only code I see for the API call is located in Timeout2.aspx.cs.
0
 
is_staffAuthor Commented:
Any other suggestions? This error is occuring whenever the web method hits timeout2.aspx page.
0
 
is_staffAuthor Commented:
Go it figured out, it just needed to call a new API to release the session
0
 
is_staffAuthor Commented:
Resolved
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now