Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Thursday, March 22, 2012

ATL & MFC vs SSIS

Hi All,

I'm trying to call ATL COM component with MFC support from SSIS Custom Component, but I can't show netiher the GUI (MFC Property Sheet) neither to call methods from my ATL component. There is no error or at least Inteligense Studio doesn't report errors. What I'm doing wrong? Thanks in advance!

Regards,

Svilen Varbanov

Wow, there's really not enough information here to know what's wrong.

What errors are you getting? How are you attempting to call the ATL code? Why?

The question is really unclear, so the answer will likely be muddled.

You should generate a primary interop assembly that you then reference and call in your script.

Kirk Haselden
Author "SQL Server Integration Services"

|||

It works! Thanks!!!

Regards,

Svilen Varbanov

Saturday, February 25, 2012

Assert Permission - ISSUE.

Hi All,
I am using a .net dll in my RDL, I have done all the steps to implement the
custom assembly in the report.
--
Message posted via http://www.sqlmonster.comLook at this thread, you have to get Reporting Services trust your DLL.
http://groups.google.de/groups?hl=de&lr=&threadm=OAxg3EQRFHA.4028%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3Dreporting%2Bservices%2Bassembly%2Bgac%26hl%3Dde%26lr%3D%26scoring%3Dd%26selm%3DOAxg3EQRFHA.4028%2540tk2msftngp13.phx.gbl%26rnum%3D1
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"BALAJI KRISHNAN via SQLMonster.com" <forum@.nospam.SQLMonster.com> schrieb
im Newsbeitrag news:25b6837f5aaf4a7589ef4ac1bd3cd615@.SQLMonster.com...
> Hi All,
> I am using a .net dll in my RDL, I have done all the steps to implement
> the
> custom assembly in the report.
> --
> Message posted via http://www.sqlmonster.com|||Sorry hit the Post Message button... Remaining Message...
I have done all the steps...
Step 1) Copying the dll to the C:\Program Files\Microsoft SQL Server\MSSQL\
Reporting Services\ReportServer\bin\
and
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ - Folders
Step 2) Create Permission Set and Code Group and changing the
rssrvpolicy.config file...
See my Permission Set and Code Group added to the file
<PermissionSet class="NamedPermissionSet"
version="1"
Name="CCPermissionSet">
<IPermission class="SecurityPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="CCPermissionSet"
Name="CCCodeGroup"
Description="">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="file://C:/Program
Files/Microsoft SQL Server/MSSQL/Reporting
Services/ReportServer/bin/CreditCardDecrypt.dll"/>
</CodeGroup>
Step 3) Refering the dll in the RDL (Properties - Reference - map dll)
Step 4) This is the Important step...Where I am missing...I need to give
the Assert permission to my code..I dont know what Assert Permission I need
to give for my dll...(As we give for SqlClientPermission...)
See my dll code...
public static string DecryptCardInfo(string cc,string subjectName,string
storeName)
{
string sCreditCard = "";
try
{
SecurityPermission secPerm = new SecurityPermission
(PermissionState.Unrestricted);
secPerm.Assert();
WSEX509.X509CertificateStore.StoreLocation location =WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
WSEX509.X509CertificateStore.StoreProvider provider =WSEX509.X509CertificateStore.StoreProvider.System;
WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
(provider, location, storeName);
bool fopen = store.OpenRead();
if(fopen)
{
WSEX509.X509CertificateCollection certs =store.FindCertificateBySubjectString(subjectName);
if (certs.Count > 0)
{
WSEX509.X509Certificate cer = certs[0];
WSECRY.RSACryptoServiceProvider rsaCsp =(WSECRY.RSACryptoServiceProvider)cer.Key;
byte[] cipherData = Convert.FromBase64String(cc);
byte[] plainData = rsaCsp.Decrypt(cipherData, false);
sCreditCard = Encoding.UTF8.GetString(plainData);
}
}
if (store != null)
store.Close();
return sCreditCard;
//return cc;
}
catch(Exception ex)
{
return ex.ToString();
}
}
}
I am in Need your help Immediately..because I am stuck with this for the
past days..and have no clue for this...
If you need any more information please send a note I can give u
immediately...
Thanks in advance...
balaji.
--
Message posted via http://www.sqlmonster.com|||Try to place you DLL in the GAC to identify wheter it is a security problem.
"BALAJI KRISHNAN via SQLMonster.com" <forum@.SQLMonster.com> schrieb im
Newsbeitrag news:7f6dadd296e74d5a9a51a62bac995613@.SQLMonster.com...
> Sorry hit the Post Message button... Remaining Message...
> I have done all the steps...
> Step 1) Copying the dll to the C:\Program Files\Microsoft SQL
> Server\MSSQL\
> Reporting Services\ReportServer\bin\
> and
> C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer\ - Folders
> Step 2) Create Permission Set and Code Group and changing the
> rssrvpolicy.config file...
> See my Permission Set and Code Group added to the file
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="CCPermissionSet">
> <IPermission class="SecurityPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <CodeGroup class="UnionCodeGroup"
> version="1"
> PermissionSetName="CCPermissionSet"
> Name="CCCodeGroup"
> Description="">
> <IMembershipCondition class="UrlMembershipCondition"
> version="1"
> Url="file://C:/Program
> Files/Microsoft SQL Server/MSSQL/Reporting
> Services/ReportServer/bin/CreditCardDecrypt.dll"/>
> </CodeGroup>
>
> Step 3) Refering the dll in the RDL (Properties - Reference - map dll)
> Step 4) This is the Important step...Where I am missing...I need to give
> the Assert permission to my code..I dont know what Assert Permission I
> need
> to give for my dll...(As we give for SqlClientPermission...)
>
> See my dll code...
> public static string DecryptCardInfo(string cc,string subjectName,string
> storeName)
> {
> string sCreditCard = "";
> try
> {
> SecurityPermission secPerm = new SecurityPermission
> (PermissionState.Unrestricted);
> secPerm.Assert();
> WSEX509.X509CertificateStore.StoreLocation location => WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
> WSEX509.X509CertificateStore.StoreProvider provider => WSEX509.X509CertificateStore.StoreProvider.System;
> WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
> (provider, location, storeName);
> bool fopen = store.OpenRead();
> if(fopen)
> {
> WSEX509.X509CertificateCollection certs => store.FindCertificateBySubjectString(subjectName);
> if (certs.Count > 0)
> {
> WSEX509.X509Certificate cer = certs[0];
> WSECRY.RSACryptoServiceProvider rsaCsp => (WSECRY.RSACryptoServiceProvider)cer.Key;
> byte[] cipherData = Convert.FromBase64String(cc);
> byte[] plainData = rsaCsp.Decrypt(cipherData, false);
> sCreditCard = Encoding.UTF8.GetString(plainData);
> }
> }
> if (store != null)
> store.Close();
> return sCreditCard;
> //return cc;
> }
> catch(Exception ex)
> {
> return ex.ToString();
> }
> }
> }
>
> I am in Need your help Immediately..because I am stuck with this for the
> past days..and have no clue for this...
> If you need any more information please send a note I can give u
> immediately...
> Thanks in advance...
> balaji.
> --
> Message posted via http://www.sqlmonster.com|||Hi Jens,
I have placed the dll in the GAC sucessfully.
But still I got #Error...
Balaji
--
Message posted via http://www.sqlmonster.com|||CAN MICROSOFT FOLKS HELP ON THIS....
STILL FACING THE ISSSUE..
THANKS IN ADVANCE
BALAJI
--
Message posted via http://www.sqlmonster.com|||Hi Balaji,
Is your problem is solve of acessing .net dll in reporting service.
I am also having the same problem where my .Net dll reads the config file to
get another file URL which has stored another file URL and using this new URL
(XML file) i am accessing the result through XMldocument and returing the
result back. But the security issue is the main issue which i am not able to
solve. If you can help me out i'll be helpful to you.
Thanks
Jasvinder
"BALAJI KRISHNAN via SQLMonster.com" wrote:
> Hi All,
> I am using a .net dll in my RDL, I have done all the steps to implement the
> custom assembly in the report.
> --
> Message posted via http://www.sqlmonster.com
>

Assembly.Load can't load my custom assembly from the GAC.

Hi there.

I have an assembly, call it A1, that I've deployed to a SQL Server 2005 database. I can use the managed stored procedures from A1 in SQL Server no problem.

In A1 there is a bit of code which uses the Assembly.Load() method, so load another assembly and use instances of class found in that external assembly. However, when I run the managed stored proc in A1 that uses Assembly.Load() I get the error:

Could not load file or assembly 'A1, Version=1.0.0.0, Culture=neutral,PublicKeyToken='?' or one of its dependencies. The system cannot find the file specified.

(note: for security I've changed some of the above line).

So I changed the Assembly.Load() to use

System.Data,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089

I re-built the project, re-deployed it and ran the code in SQL Server - it worked. I could create an instance of a System.Data.DataSet for example. So why can't I load my own custom assembly? My assembly does have a strong name and it's installed in the GAC. I wrote a console app to try and Assembly.Load() my custom assembly and that worked fine (it was also running on the same server as the SQL Server).

So it's defiantely the SQL Server that can't 'see' my customer assembly. What do I need to do this assembly so that SQL Server will allow me to Assembly.Load it, just as it can with System.Data?

Thanks
Jas.

Hi Jas,

In order you load your assembly using Assembly.Load, the assembly already has to be loaded into your database using CREATE ASSEMBLY. SqlClr will only load assemblies directly from the gac that are on the list of supported framework assemblies available here: http://msdn2.microsoft.com/en-us/library/ms403279.aspx. All the assemblies on that list (including System.Data) can be accessed by any assembly in your database, but all other assemblies must be loaded using CREATE ASSEMBLY first.

Steven

Assembly name for SSIS built-in UITypeEditors?

I have a custom PipelineComponent that accepts a string of SQL. I don't have a custom UI, all I need is the Advanced Editor. Currently the SQL property is just the standard line of text that can be entered on the Advanced Editor. I would like to use the popup multi-line editor that the built-in components use for editing SQL. I was hoping it was the System.ComponentModel.Design.MultilineStringEditor but that is definitely not it (and that one is insufficient for entering more than a few lines of SQL). I'm assuming it must be a UITypeEditor that was shipped as part of SQL 2005, but I haven't been able to track down the qualified assembly name for it anywhere. I tried debugging in VS to get down to a IDTSCustomProperty90 that I could look at the UITypeEditor on, but no such like. I also tried using Reflector to see if I could dig up a string, but no luck there either as the pipeline components don't seem to have managed assemblies (I could've just missed them) and the control tasks (which happen to use the UITypeEditor I'm looking for too) seem to only be thin wrappers around COM interfaces. I scoured BOL and the WWW in general for a list of these assembly names, but looks like they're not out there either. Has anyone tried to find these before? Am I barking up the wrong tree, should I not be able to use these editors for copyright reasons?Using undocumented stuff like that could get messy, but most importantly for me I think most of the editors are rather poor. Simple things like support for Ctrl+A to select all text are missing. For what you want I would write my own, not too hard and you can make it much more user friendly. Not the answer you wanted I suspect, but really I think it would be probably faster and certainly better to write your own.

Assembly access SQL DB don't work in Windows Server 2003

I try to get a custom assembly running with Reporting Services on Windows
Server 2003. The assembly must access a SQL Server database on the same SQL
Server as Reporting Services (localhost)
The assembly is written with VB .NET 2003. I have a assembly running
accessing a oracle db, this assembly works. So I know the security settings
etc. But the problem must be somewhere in detail. Therefore detailed answers
are appreciated.
The assembly works in the designer but not in Report Server on Windows
Server 2003. The assembly get accessed by the report server but obviously the
database connection failed.
Content bellow:
- rsvPolicy.config settings
- Code in assembly
- Additional information
Settings in the rsvPolicy.config:
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants read access to my file.">
<IPermission class="System.Data.OleDb.OleDbPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants read access to my file.">
<IPermission class="System.Security.PermissionSet"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
Code in the assembly
' declaration of the security object in the header of the class
Private m_objSecurity As System.Security.PermissionSet
Private m_strConnString As String = _
"Provider=SQLOLEDB;Data Source=localhost;Initial
Catalog=MyDatabase;Integrated Security=SSPI;"
' function to open the db
<PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
Public Function OpenDBConn() As Boolean
m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
m_objSecurity.Assert()
m_objDBConn = New
System.Data.OleDB.OleDbConnection(m_strConnString)
m_objDBConn.Open()
If m_objDBConn.State = ConnectionState.Open Then
InitSQLSRVConn = True
End IF
Addional information:
IDE: .net 2003
SQL Server 2000 SP3a
Windows Server 2003
Reporting Services Enterprise Edition + SP 2The assembly works on a Windows 2000 (SP4) Machine.
For this reason I assume that the problem is related to Windows 2003 Server,
or with SP2 from Reporting Services in relation with Windows 2003 Server.
Just for the sake of completnes bellowe the code meanwhile tried on both
Systems (W2K and W2K3 Srv)
--
In rssrvpoliciy.config:
--
<PermissionSet class="NamedPermissionSet"
version="1"
Name="MyNewFilePermissionSet"
Description="A special permission set that grants access to SQL Server
Database.">
<IPermission class="System.Data.OleDB.OleDbPermission"
version="1"
Flags="Assertion, Execution"/>
</PermissionSet>
'--
' In the Assembly
'--
Private m_objSecurity As System.Data.OleDB.OleDbPermission
Private m_strConnString As String = _
"Provider=SQLOLEDB;Data Source=localhost;Initial
Catalog=myDatabase;Integrated Security=SSPI;"
<PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
Public Function InitSQLSRVConn() As Boolean
m_objSecurity = New
System.Data.OleDb.OleDbPermission(PermissionState.Unrestricted)
m_objSecurity.Assert()
m_objDBConn = New
System.Data.OleDB.OleDbConnection(m_strConnString)
m_objDBConn.Open()
If m_objDBConn.State = ConnectionState.Open Then
InitSQLSRVConn = True
End if
"Dev Main" wrote:
> I try to get a custom assembly running with Reporting Services on Windows
> Server 2003. The assembly must access a SQL Server database on the same SQL
> Server as Reporting Services (localhost)
> The assembly is written with VB .NET 2003. I have a assembly running
> accessing a oracle db, this assembly works. So I know the security settings
> etc. But the problem must be somewhere in detail. Therefore detailed answers
> are appreciated.
> The assembly works in the designer but not in Report Server on Windows
> Server 2003. The assembly get accessed by the report server but obviously the
> database connection failed.
> Content bellow:
> - rsvPolicy.config settings
> - Code in assembly
> - Additional information
> Settings in the rsvPolicy.config:
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Data.OleDb.OleDbPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Security.PermissionSet"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
>
> Code in the assembly
> ' declaration of the security object in the header of the class
> Private m_objSecurity As System.Security.PermissionSet
> Private m_strConnString As String = _
> "Provider=SQLOLEDB;Data Source=localhost;Initial
> Catalog=MyDatabase;Integrated Security=SSPI;"
> ' function to open the db
> <PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
> Public Function OpenDBConn() As Boolean
> m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
> m_objSecurity.Assert()
> m_objDBConn = New
> System.Data.OleDB.OleDbConnection(m_strConnString)
> m_objDBConn.Open()
> If m_objDBConn.State = ConnectionState.Open Then
> InitSQLSRVConn = True
> End IF
>
> Addional information:
> IDE: .net 2003
> SQL Server 2000 SP3a
> Windows Server 2003
> Reporting Services Enterprise Edition + SP 2
>
>|||At least the version in my second post works correct. The reason for the
failure was a other mistake not related to reporting services at all.
"Dev Main" wrote:
> I try to get a custom assembly running with Reporting Services on Windows
> Server 2003. The assembly must access a SQL Server database on the same SQL
> Server as Reporting Services (localhost)
> The assembly is written with VB .NET 2003. I have a assembly running
> accessing a oracle db, this assembly works. So I know the security settings
> etc. But the problem must be somewhere in detail. Therefore detailed answers
> are appreciated.
> The assembly works in the designer but not in Report Server on Windows
> Server 2003. The assembly get accessed by the report server but obviously the
> database connection failed.
> Content bellow:
> - rsvPolicy.config settings
> - Code in assembly
> - Additional information
> Settings in the rsvPolicy.config:
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Data.OleDb.OleDbPermission"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
> <PermissionSet class="NamedPermissionSet"
> version="1"
> Name="MyNewFilePermissionSet"
> Description="A special permission set that grants read access to my file.">
> <IPermission class="System.Security.PermissionSet"
> version="1"
> Flags="Assertion, Execution"/>
> </PermissionSet>
>
> Code in the assembly
> ' declaration of the security object in the header of the class
> Private m_objSecurity As System.Security.PermissionSet
> Private m_strConnString As String = _
> "Provider=SQLOLEDB;Data Source=localhost;Initial
> Catalog=MyDatabase;Integrated Security=SSPI;"
> ' function to open the db
> <PermissionSet(SecurityAction.Assert, Unrestricted:=True)> _
> Public Function OpenDBConn() As Boolean
> m_objSecurity = New PermissionSet(PermissionState.Unrestricted)
> m_objSecurity.Assert()
> m_objDBConn = New
> System.Data.OleDB.OleDbConnection(m_strConnString)
> m_objDBConn.Open()
> If m_objDBConn.State = ConnectionState.Open Then
> InitSQLSRVConn = True
> End IF
>
> Addional information:
> IDE: .net 2003
> SQL Server 2000 SP3a
> Windows Server 2003
> Reporting Services Enterprise Edition + SP 2
>
>

AspNetSessionExpiredException - Your results may vary?

I have a custom reporting application that displays Sql Server Reporting Services reports on an ASP.NET page using Microsoft's report viewer control. The SSRS reports are local reports (they have an rdlc extension).

When a report is left inactive for a lengthy period of time it generates anAspNetSessionExpiredException when the user attempts to move to a new page. The thing that is surprising is that the formatted exception display is contained within the report viewer. The report document map remains visible as does the report toolbar. In the right pane where the report normally appears I see a standard, raw, ASP.NET exception display.

I'm surprised that the report viewer is "catching" the exception and displaying it within the report viewer. Standard events in the page that hosts the report viewer (PreInit, Init, PageLoad) are never invoked.

I have graceful error handling defined in a base page class but it does me no good because the exception never reaches the page code-behind. Puzzling.

Do any of you ASP.NET developers know if it is possible to catch theAspNetSessionExpiredExceptionso that I can handle it in my application code rather than having SSRS display a very ugly, very raw exception message.

I've included the exception message below.

Thanks.

BlackCatBone

...

Server Error in '/templatedemo' Application.

------------------------

ASP.NET session has expired

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.Reporting.WebForms.AspNetSessionExpiredException: ASP.NET session has expired

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:

[AspNetSessionExpiredException: ASP.NET session has expired]

Microsoft.Reporting.WebForms.ReportDataOperation..ctor() +683

Microsoft.Reporting.WebForms.HttpHandler.GetHandler() +553

Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +10

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

I am having exactly the same problem. If anyone knows the solution to this it would be fabulous to here from you.

|||

I had the same problem and I found the solution in this posthttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=170875&SiteID=1. See Brian Hartman's post regarding sessionState. I used his suggestion of using the out-of-process session state as StateServer mode and it fixed the issue for me. Good luck.

Sunday, February 19, 2012

ASPNET permissions error when trying to open an Oracle connectin from a custom assembly.

Hello:
I'm receiving the following error while trying to open an Oracle connection
from a custom assembly; it seems that ASP.NET has insufficient permissions.
OracleConnection oc = null;
// v-- creating connection object, this
is where the exception throws..
oc = new OracleConnection(Def.ConnectString +
";User Id=" + Def.UserName + ";Password=pwdtxt");
I've assigned "FullTrust" to all the CodeGroup entries on my config files,
and I can execute the code in the custom assembly but I can not open a
database connection.
Is there any security setting related with this?
Thanks,
Daniel Bello.
<ErrorCode
xmlns="http://www.microsoft.com/sql/reportingservices">rsAccessDenied</ErrorCode><HttpStatus
xmlns="http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message
xmlns="http://www.microsoft.com/sql/reportingservices">The permissions
granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing this
operation.</Message><HelpLink
xmlns="http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName
xmlns="http://www.microsoft.com/sql/reportingservices">Microsoft SQL Server
Reporting Services</ProductName><ProductVersion
xmlns="http://www.microsoft.com/sql/reportingservices">9.00.1399.00</ProductVersion><ProductLocaleId
xmlns="http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem
xmlns="http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
xmlns="http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation
xmlns="http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
msrs:ErrorCode="rsAccessDenied"
msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00"
xmlns:msrs="http://www.microsoft.com/sql/reportingservices">The permissions
granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing this
operation.</Message></MoreInformation><Warnings
xmlns="http://www.microsoft.com/sql/reportingservices" />I added the ASPNET user to HOME with Browser and Content Manager permissions
and it works now.
Does anyoune has an explanation for this?
Thanks,
Daniel Bello.
"Daniel Bello" <dburizarri@.yahoo.es> wrote in message
news:OzjxxzYRHHA.4000@.TK2MSFTNGP04.phx.gbl...
> Hello:
> I'm receiving the following error while trying to open an Oracle
> connection from a custom assembly; it seems that ASP.NET has insufficient
> permissions.
> OracleConnection oc = null;
> // v-- creating connection object, this
> is where the exception throws..
> oc = new OracleConnection(Def.ConnectString +
> ";User Id=" + Def.UserName + ";Password=pwdtxt");
> I've assigned "FullTrust" to all the CodeGroup entries on my config files,
> and I can execute the code in the custom assembly but I can not open a
> database connection.
> Is there any security setting related with this?
> Thanks,
> Daniel Bello.
> <ErrorCode
> xmlns="rsAccessDenied</ErrorCode><HttpStatus">http://www.microsoft.com/sql/reportingservices">rsAccessDenied</ErrorCode><HttpStatus
> xmlns="400</HttpStatus><Message">http://www.microsoft.com/sql/reportingservices">400</HttpStatus><Message
> xmlns="The">http://www.microsoft.com/sql/reportingservices">The permissions
> granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for performing
> this operation.</Message><HelpLink
> xmlns="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName">http://www.microsoft.com/sql/reportingservices">http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00</HelpLink><ProductName
> xmlns="Microsoft">http://www.microsoft.com/sql/reportingservices">Microsoft SQL
> Server Reporting Services</ProductName><ProductVersion
> xmlns="9.00.1399.00</ProductVersion><ProductLocaleId">http://www.microsoft.com/sql/reportingservices">9.00.1399.00</ProductVersion><ProductLocaleId
> xmlns="127</ProductLocaleId><OperatingSystem">http://www.microsoft.com/sql/reportingservices">127</ProductLocaleId><OperatingSystem
> xmlns="OsIndependent</OperatingSystem><CountryLocaleId">http://www.microsoft.com/sql/reportingservices">OsIndependent</OperatingSystem><CountryLocaleId
> xmlns="1033</CountryLocaleId><MoreInformation">http://www.microsoft.com/sql/reportingservices">1033</CountryLocaleId><MoreInformation
> xmlns="<Source>ReportingServicesLibrary</Source><Message">http://www.microsoft.com/sql/reportingservices"><Source>ReportingServicesLibrary</Source><Message
> msrs:ErrorCode="rsAccessDenied"
> msrs:HelpLink="http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsAccessDenied&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.00.1399.00"
> xmlns:msrs="The">http://www.microsoft.com/sql/reportingservices">The
> permissions granted to user 'WCORPTWJTCCPB1\ASPNET' are insufficient for
> performing this operation.</Message></MoreInformation><Warnings
> xmlns="http://www.microsoft.com/sql/reportingservices" />
>

Thursday, February 9, 2012

ASP.NET / SQL 2k Membership prob

Almost have my custom membershipprovider finsihed, but have ran into a small snag.

Scenario:: 2 methods. CreateUser(blah blah) and ValidateUserName(string username). CreateUserWizard control calls CreateUser(blah blah) which in the start of the method calls ValidateUserName(string username). ValidateUserName runs astored procedure onSQL 2k to check and see if user exists in the db. Returns a bool true or false. If true, then everything works correctly and returns a message displaying that the user exists, please enter a different name.

Now the problem. If it returns false, meaning that the username doesnt exist and is available to use, it calls a stored procedure to create the record in the users db. This is where the problem lies. It does NOTHING but sit there waiting. But it never seems to time out. If I comment out the validating. It will add a record successfully.

Im wondering if it has something to do with calling 2stored procedures consecutivly??

::CODE TO FOLLOW::Heres the code.
------------

public override MembershipUser CreateUser(string username, stringpassword, stringemail, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
{
SqlConnection connect = null;
SqlCommand cmd = null;
MembershipUser newUser = null;

if (!ValidateUsername(username))
{
status = MembershipCreateStatus.DuplicateUserName;
return null;
}

try
{
connect = new SqlConnection(ConfigurationManager.ConnectionStrings[ConnString].ConnectionString);

cmd = new SqlCommand("createuser", connect);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add(new SqlParameter("@.UserName", username));
cmd.Parameters.Add(new SqlParameter("@.Pwd", password));
cmd.Parameters.Add(new SqlParameter("@.PwdQuestion", passwordQuestion));
cmd.Parameters.Add(new SqlParameter("@.PwdAnswer", passwordAnswer));
cmd.Parameters.Add(new SqlParameter("@.Email", email));
cmd.Parameters.Add(new SqlParameter("@.Comment", _Name));
cmd.Parameters.Add(new SqlParameter("@.IsApproved", MyMethods.BoolToInt(isApproved)));
cmd.Parameters.Add("@.IsLockedOut", SqlDbType.Bit).Value = 0;
cmd.Parameters.Add(new SqlParameter("@.CreationDate", DateTime.Now));
cmd.Parameters.Add(new SqlParameter("@.LastLoginDate", DateTime.Now));

connect.Open();
cmd.ExecuteNonQuery();

// Right now I am giving default values for DateTime
// in Membership constructor.
newUser = new MembershipUser(
_Name,
username, null, String.Empty, String.Empty,
String.Empty, true, false, DateTime.Now,
DateTime.Now, DateTime.Now, DateTime.Now,
DateTime.Now
);
status = MembershipCreateStatus.Success;
}
catch (Exception ex)
{
status = MembershipCreateStatus.ProviderError;
newUser = null;
throw ex;
}
finally
{
cmd.Dispose();
connect.Close();
}
return newUser;
}

private bool ValidateUsername(string userName)
{
SqlConnection conn = null;
SqlCommand cmd = null;
SqlDataReader reader = null;
bool IsValid = false;

try
{
conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings[ConnString].ConnectionString;

cmd = new SqlCommand("CheckUsername", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@.Username", userName));

conn.Open();
reader = cmd.ExecuteReader();
while (!reader.Read())
{
IsValid = true;
}
return IsValid;
}
catch (Exception ex)
{
throw ex;
}
finally
{
reader.Close();
cmd.Dispose();
conn.Close();
}
}|||

OK! NOT EVERYONE AT ONCE ! <big grin>

just kidding, anyways figured out the problem after pulling all but one last hair out.

The "while(!reader.Read())" was causing problems, just replaced it with "while(reader.HasRows)" and viola, it worked. Beats me.