Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Tuesday, March 20, 2012

Custom Security Extension issue...

I have tried to write a custom security extension. When I run the report
manager I get ...
Object Reference is not set to an instance of an object.
It's breaking in GlobalApp.Application_AuthenticationRequest
I figure its because it can't find my extension but I have the correct Url
in the securityextensioncodegroup. Could it be the type attibute in the
extension tag?
Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"You may be getting the exception in the GetWebRequest override in the
derived ReportingService class because the HttpContext.Current.Request is
null which causes the call to the AuthCookie property to fail. I'm having a
similar problem that I'm working through right now. Maybe this will give you
some place to start looking for the problem.
Just a thought...
Garry
"Tad" <Tad@.discussions.microsoft.com> wrote in message
news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
> I have tried to write a custom security extension. When I run the report
> manager I get ...
> Object Reference is not set to an instance of an object.
> It's breaking in GlobalApp.Application_AuthenticationRequest
> I figure its because it can't find my extension but I have the correct Url
> in the securityextensioncodegroup. Could it be the type attibute in the
> extension tag?
> Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"|||Gary,
Have you found a solution to this issue of the
HttpContext.Current.Request being null or found more information on
what might cause this to be null?
- Jessica
Garry Lenz wrote:
> You may be getting the exception in the GetWebRequest override in the
> derived ReportingService class because the
HttpContext.Current.Request is
> null which causes the call to the AuthCookie property to fail. I'm
having a
> similar problem that I'm working through right now. Maybe this will
give you
> some place to start looking for the problem.
> Just a thought...
> Garry
>
> "Tad" <Tad@.discussions.microsoft.com> wrote in message
> news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
> > I have tried to write a custom security extension. When I run the
report
> > manager I get ...
> >
> > Object Reference is not set to an instance of an object.
> >
> > It's breaking in GlobalApp.Application_AuthenticationRequest
> >
> > I figure its because it can't find my extension but I have the
correct Url
> > in the securityextensioncodegroup. Could it be the type attibute
in the
> > extension tag?
> >
> > Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"|||This looks familiar. It could be one of a myriad of things. In our case,
the custom security extension called a web service, and there was an invalid
type definition in the web reference. We had to delete all our binaries and
web references from the development environment, reattach the web references
and recompile. Then it worked.
I hope that points you in the right direction. Bottom line issue: don't
lose your cookies.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
<Jessica.Landisman@.ndchealth.com> wrote in message
news:1105364285.978877.33130@.c13g2000cwb.googlegroups.com...
> Gary,
> Have you found a solution to this issue of the
> HttpContext.Current.Request being null or found more information on
> what might cause this to be null?
> - Jessica
> Garry Lenz wrote:
>> You may be getting the exception in the GetWebRequest override in the
>> derived ReportingService class because the
> HttpContext.Current.Request is
>> null which causes the call to the AuthCookie property to fail. I'm
> having a
>> similar problem that I'm working through right now. Maybe this will
> give you
>> some place to start looking for the problem.
>> Just a thought...
>> Garry
>>
>> "Tad" <Tad@.discussions.microsoft.com> wrote in message
>> news:CF04B8C0-641A-4D50-9A90-B49625266D90@.microsoft.com...
>> > I have tried to write a custom security extension. When I run the
> report
>> > manager I get ...
>> >
>> > Object Reference is not set to an instance of an object.
>> >
>> > It's breaking in GlobalApp.Application_AuthenticationRequest
>> >
>> > I figure its because it can't find my extension but I have the
> correct Url
>> > in the securityextensioncodegroup. Could it be the type attibute
> in the
>> > extension tag?
>> >
>> > Type="RSSecurity.AuthorizationExtension,AuthorizationExtension"
>sql

Monday, March 19, 2012

Custom Security + Object Moved to here

I have the Custom Security model in place, and it all seems to be working. I
authenticate the user upon login.
when i try the code below, i get the follwing error:
object Move to here. The hyperlink being
http://somedomina/ReportServer/logon.aspx?ReturnUrl=Reportservice2005.asmx
Does anyone now how to get around this?
Dim rs As New ReportingService2005
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim item As CatalogItem
For Each item In rs.ListChildren("/Reports", False)
If item.Type = ItemTypeEnum.Report Then
Me.ddReports.Items.Add(New ListItem(item.Name, item.Path))
End If
NextYou have to call LogonUser from your report service proxy.
that gets you the cookie to request such operations.
"ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
news:68E2E101-9CAD-443A-8670-9EFE677D20CB@.microsoft.com...
>I have the Custom Security model in place, and it all seems to be working.
>I
> authenticate the user upon login.
> when i try the code below, i get the follwing error:
> object Move to here. The hyperlink being
> http://somedomina/ReportServer/logon.aspx?ReturnUrl=Reportservice2005.asmx
> Does anyone now how to get around this?
> Dim rs As New ReportingService2005
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> Dim item As CatalogItem
> For Each item In rs.ListChildren("/Reports", False)
> If item.Type = ItemTypeEnum.Report Then
> Me.ddReports.Items.Add(New ListItem(item.Name,
> item.Path))
> End If
> Next|||Thanks for replying back. When i called LogonUser, i received an error. I
read that LogonUser only works with SSL enabled. Is there a way to call
LogonUser without SSL? Can you give me some example code, to make sure i did
not miss anything?
"Chris Taylor" wrote:
> You have to call LogonUser from your report service proxy.
> that gets you the cookie to request such operations.
>
> "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
> news:68E2E101-9CAD-443A-8670-9EFE677D20CB@.microsoft.com...
> >I have the Custom Security model in place, and it all seems to be working.
> >I
> > authenticate the user upon login.
> >
> > when i try the code below, i get the follwing error:
> > object Move to here. The hyperlink being
> >
> > http://somedomina/ReportServer/logon.aspx?ReturnUrl=Reportservice2005.asmx
> >
> > Does anyone now how to get around this?
> >
> > Dim rs As New ReportingService2005
> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> > Dim item As CatalogItem
> > For Each item In rs.ListChildren("/Reports", False)
> > If item.Type = ItemTypeEnum.Report Then
> > Me.ddReports.Items.Add(New ListItem(item.Name,
> > item.Path))
> > End If
> > Next
>
>|||No LogonUser works without SSL, it's not a "Best Practice" or anything like
that, but it works just fine.
Can you tell me about the error you received calling it?
Thanks,
Chris
"ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
news:1478ACC7-DF13-48E8-9D24-9080A3255D75@.microsoft.com...
> Thanks for replying back. When i called LogonUser, i received an error.
> I
> read that LogonUser only works with SSL enabled. Is there a way to call
> LogonUser without SSL? Can you give me some example code, to make sure i
> did
> not miss anything?
> "Chris Taylor" wrote:
>> You have to call LogonUser from your report service proxy.
>> that gets you the cookie to request such operations.
>>
>> "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
>> news:68E2E101-9CAD-443A-8670-9EFE677D20CB@.microsoft.com...
>> >I have the Custom Security model in place, and it all seems to be
>> >working.
>> >I
>> > authenticate the user upon login.
>> >
>> > when i try the code below, i get the follwing error:
>> > object Move to here. The hyperlink being
>> >
>> > http://somedomina/ReportServer/logon.aspx?ReturnUrl=Reportservice2005.asmx
>> >
>> > Does anyone now how to get around this?
>> >
>> > Dim rs As New ReportingService2005
>> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials
>> > Dim item As CatalogItem
>> > For Each item In rs.ListChildren("/Reports", False)
>> > If item.Type = ItemTypeEnum.Report Then
>> > Me.ddReports.Items.Add(New ListItem(item.Name,
>> > item.Path))
>> > End If
>> > Next
>>|||It just seems like it never does authenticate. Can you give me some sample
code to go off of?
"Chris Taylor" wrote:
> No LogonUser works without SSL, it's not a "Best Practice" or anything like
> that, but it works just fine.
> Can you tell me about the error you received calling it?
> Thanks,
> Chris
> "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
> news:1478ACC7-DF13-48E8-9D24-9080A3255D75@.microsoft.com...
> > Thanks for replying back. When i called LogonUser, i received an error.
> > I
> > read that LogonUser only works with SSL enabled. Is there a way to call
> > LogonUser without SSL? Can you give me some example code, to make sure i
> > did
> > not miss anything?
> >
> > "Chris Taylor" wrote:
> >
> >> You have to call LogonUser from your report service proxy.
> >>
> >> that gets you the cookie to request such operations.
> >>
> >>
> >> "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
> >> news:68E2E101-9CAD-443A-8670-9EFE677D20CB@.microsoft.com...
> >> >I have the Custom Security model in place, and it all seems to be
> >> >working.
> >> >I
> >> > authenticate the user upon login.
> >> >
> >> > when i try the code below, i get the follwing error:
> >> > object Move to here. The hyperlink being
> >> >
> >> > http://somedomina/ReportServer/logon.aspx?ReturnUrl=Reportservice2005.asmx
> >> >
> >> > Does anyone now how to get around this?
> >> >
> >> > Dim rs As New ReportingService2005
> >> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> >> > Dim item As CatalogItem
> >> > For Each item In rs.ListChildren("/Reports", False)
> >> > If item.Type = ItemTypeEnum.Report Then
> >> > Me.ddReports.Items.Add(New ListItem(item.Name,
> >> > item.Path))
> >> > End If
> >> > Next
> >>
> >>
> >>
>
>|||I still get the Object Moved to here message. Can anyone help me?
my code looks like:
Dim rs As New wsEcho.ReportingService2005
rs.Url ="http://domainname/reportserver/reportexecution2005.asmx?wsdl"
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.LogonUser("admin", "somepassword", Nothing)
Dim item As wsEcho.CatalogItem
For Each item In rs.ListChildren("/Reports", False)
If item.Type = ItemTypeEnum.Report Then
Me.ddReports.Items.Add(New ListItem(item.Name, item.Path))
End If
Next|||Let me ask you this about wsEcho.ReportingService2005. Is this a direct
reference to the web service itself?
If so, it doesn't quite work that way. In the samples that come with 2005
in the UILogon.aspx.cs file there is *another* class embedded in there
called ReportProxy. This is very very important as it overrides two
important methods
GetWebRequest,
GetWebResponse
which does all the cookie work for you in this case.
It looks like you are not doing so. Which is why you are having it redirect
you.
also, setting rs.Credentials really isn't important since you have anonymous
access probably turned on.
"ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
news:48EA1A8C-2F49-413C-BD4C-7CEAB367698C@.microsoft.com...
>I still get the Object Moved to here message. Can anyone help me?
> my code looks like:
> Dim rs As New wsEcho.ReportingService2005
> rs.Url => "http://domainname/reportserver/reportexecution2005.asmx?wsdl"
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> rs.LogonUser("admin", "somepassword", Nothing)
> Dim item As wsEcho.CatalogItem
> For Each item In rs.ListChildren("/Reports", False)
> If item.Type = ItemTypeEnum.Report Then
> Me.ddReports.Items.Add(New ListItem(item.Name,
> item.Path))
> End If
> Next
>|||Perfect! Makes total sense now. I wasn't even thiking. I took your advice,
and now it works the way i need it. Much thanks for all your help!!!
"Chris Taylor" wrote:
> Let me ask you this about wsEcho.ReportingService2005. Is this a direct
> reference to the web service itself?
> If so, it doesn't quite work that way. In the samples that come with 2005
> in the UILogon.aspx.cs file there is *another* class embedded in there
> called ReportProxy. This is very very important as it overrides two
> important methods
> GetWebRequest,
> GetWebResponse
> which does all the cookie work for you in this case.
> It looks like you are not doing so. Which is why you are having it redirect
> you.
> also, setting rs.Credentials really isn't important since you have anonymous
> access probably turned on.
>
> "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
> news:48EA1A8C-2F49-413C-BD4C-7CEAB367698C@.microsoft.com...
> >I still get the Object Moved to here message. Can anyone help me?
> >
> > my code looks like:
> >
> > Dim rs As New wsEcho.ReportingService2005
> > rs.Url => > "http://domainname/reportserver/reportexecution2005.asmx?wsdl"
> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> >
> > rs.LogonUser("admin", "somepassword", Nothing)
> >
> > Dim item As wsEcho.CatalogItem
> > For Each item In rs.ListChildren("/Reports", False)
> > If item.Type = ItemTypeEnum.Report Then
> > Me.ddReports.Items.Add(New ListItem(item.Name,
> > item.Path))
> > End If
> > Next
> >
>
>|||I tried this but I am still getting the 401 error. In the 2005 Security
Extension Sample (Readme_FormsAuthenication.htm), there is the following:
**************** FROM Readme_FormsAuthenication.htm
Using the Web Service with Custom Security
You can use the Web service API with Forms Authentication just as you would
with Windows Authentication. However, you must call LogonUser in your Web
service code and pass the credentials of the current user. In addition, your
Web service client will not have the benefit of automatic cookie management,
which is provided by Internet Explorer or other Web browsers. You will have
to extend the Microsoft.ReportingServices proxy class to include cookie
management. This can be done by overriding the GetWebRequest and
GetWebResponse methods of the Web service class.
****************
I think what is holding us up now is this, because the code in
UILogon.aspx.cs that does the above, in the routines WebRequest and
WebResponse runs, but has not been modififed. Then the IIS 401 error occurs.
LogonUser apparently never gets called. I am not sure how to do this, so I
am looking for a pointer to the correct direction.
It appears some modification of these overrides is called for, but I am not
sure how to do this. Can you provide some direction?
nickpup
nickpup@.yahoo.comNONSPAM
Please let me know...
"ghoff12" wrote:
> Perfect! Makes total sense now. I wasn't even thiking. I took your advice,
> and now it works the way i need it. Much thanks for all your help!!!
> "Chris Taylor" wrote:
> > Let me ask you this about wsEcho.ReportingService2005. Is this a direct
> > reference to the web service itself?
> >
> > If so, it doesn't quite work that way. In the samples that come with 2005
> > in the UILogon.aspx.cs file there is *another* class embedded in there
> > called ReportProxy. This is very very important as it overrides two
> > important methods
> >
> > GetWebRequest,
> > GetWebResponse
> >
> > which does all the cookie work for you in this case.
> >
> > It looks like you are not doing so. Which is why you are having it redirect
> > you.
> >
> > also, setting rs.Credentials really isn't important since you have anonymous
> > access probably turned on.
> >
> >
> >
> > "ghoff12" <ghoff12@.discussions.microsoft.com> wrote in message
> > news:48EA1A8C-2F49-413C-BD4C-7CEAB367698C@.microsoft.com...
> > >I still get the Object Moved to here message. Can anyone help me?
> > >
> > > my code looks like:
> > >
> > > Dim rs As New wsEcho.ReportingService2005
> > > rs.Url => > > "http://domainname/reportserver/reportexecution2005.asmx?wsdl"
> > > rs.Credentials = System.Net.CredentialCache.DefaultCredentials
> > >
> > > rs.LogonUser("admin", "somepassword", Nothing)
> > >
> > > Dim item As wsEcho.CatalogItem
> > > For Each item In rs.ListChildren("/Reports", False)
> > > If item.Type = ItemTypeEnum.Report Then
> > > Me.ddReports.Items.Add(New ListItem(item.Name,
> > > item.Path))
> > > End If
> > > Next
> > >
> >
> >
> >

Sunday, March 11, 2012

Custom Object Wide Roles

Can we create custom object wide roles? In the same manner that db_datareader in effect grants SELECT on all tables, can we create roles that affect all objects without having to explicitly grant the permission on every object?

Yes, you can create a role and grant to it SELECT on the database, that is actually how db_datareader works as well. You can grant permissions on containers and they will apply to the contained objects. Databases and schemas are such containers.

Thanks
Laurentiu

Custom object or DataSet ?

Hello
I'm using SQL 2000 server and I have question about logining to server. Is it possible to include Active Directory structure? I know I can define SQL user or use Windows Based Account, but I havent read anywhere how to integrate Active Directory. If there is solution or if anybody has experience with this problem, I would be grateful forhelp or reference (btw, I'm using win 2003 server).

Thanks
MatjazCheck this link (http://search.win2000mag.net/query.html) and corresponding links.

Custom Object in SSIS

I wrote a C# class that has a couple of methods that can be called to grab data out of a flat file and import it to a DB. This class was written for a web applicaiton originally. (class has many complex business rules in it)

Now I would like to use this same class in a SSIS package.

Is it possible in a script task to create a new object with my class and use it's methods?

In the end all I want SSIS to do is create my object, call a method in that object and be done.

If I was doing this in DTS, I would have to create an .Net EXE that used my class but I'm hoping to avoid that in SSIS.

Frenchy

The simplest way would be to use the class as-is, and just reference it from a Script Task, which gives you a VB.Net environment to create your class and call your methods as required. You can also leverage connections and variables for a more integrated and dynamic approach if required. You will need to place your assembly in a defined folder to get the Add Reference to work on VSA, the script environment used by SSIS - http://msdn2.microsoft.com/en-us/library/ms136007.aspx|||

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

|||

Pooja B wrote:

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

Darren answered this question already (above). Is anythig not clear?

-Jamie

|||

Thanks Jamie. No its clear but I am totally new to SSIS so dont have that much understanding. Can you send me some sample code that is accessing already existing classes in Script task.

Thank you so much...

Pooja

|||If you follow the steps in Darren's post (adding a reference to the .dll that holds your custom code), then you just create a new instance of the object and begin using it - just like you would in any .NET code.|||

For adding a reference to required dlls we need to make them strongly typed. I made them strongly typed and added them to ../windows/microsoft.net/framework/2.0.., then I am able to run my code sucessfully but could not access these dlls in SSIS package. When I add these dlls in GAC then I could access the dlls in SSIS packages but then my application starts giving errors as it gould not refer some of the dlls because of making it strongly named. Can you please suggest what could be the problem. I am using microsoft enterprise libraries in my code.

Thanks,

Pooja

|||This is really a question for a different forum - you might try one of the groups under .NET Development.|||

PLEASE help us to help you-

What application gives these errors?

What are the errors?

An existing application that referenced non-strong named assemblies should keep working fine, assuming you have left the old assemblies in place. It would however make senses to updae your code to use the new strong named version so that all code, SSIS and other applictions, share the same common assemblies.

|||

Thanks for your reply. I am able to fix that problem. In my appplication as I strongly named the assemblies, it was not able to find that in GAC so i need to change that in my app.config file.

I am new to SSIS, Can you please tell me how to specify configuration settings for SSIS. Like my cofiguration settings are like this.

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add

name="abc_Dev"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=" />

<add

name="abc_Prod"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=;" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc_Dev"/>

</configuration>

Thanks,

Pooja

|||Take a look at "Package Configurations" in SQL Server Books Online.|||

I have a similar scenario - EntLib and SSIS. I'm afraid I haven't found a way to use the same configuration file - both SSIS and EntLib have their own ideas about file format.

What I do is to manage the EntLib configuration files in the usual way (as in your code example above); and for the SSIS packages I use XML package configurations. You can find out more about these at http://msdn2.microsoft.com/en-us/library/ms141682.aspx.

|||

I specified the database configuration like this but how to specify the configsections for EntLib in XML configuration secion.

<DTSConfiguration>
<Configuration
ConfiguredType="Property"
Path="\Package.Connections[ConnectionName].Properties[ConnectionString]"
ValueType="String">
<ConfiguredValue>

Data Source=[Server Name];

User ID=[user name];

Initial Catalog=[database name];

</ConfiguredValue>
</Configuration>

</DTSConfiguration>

Can you please show me the dtsconfig xml file that you used in your application.

Thanks,

Pooja

|||

SSIS configurations and Enterprise Library configurations are clearly not the same, SSIS has no concept of .Net configurations. You will never be able to get SSIS to use Ent Lib config sections.

The best you can ever do is get .Net code hosted in SSIS to use Ent Lib config. This is not the same as making SSIS use Ent Lib or it's config, this is using .Net code. This is important if you have managed code, that uses Ent Lib functions. As covered above, to use external (external to SSIS I mean) assemblies, you need to ensure they are in the GAC, a challenge for first time Ent Lib builds.

For the configuration, think about how any .Net config works, the host process is responsible for loading it. So if you write an assembly which calls Microsoft.Practices.EnterpriseLibrary.ExceptionHandling stuff, and you want the exceptionHandling\exceptionPolicies config stuff to be available, then you need to add that to the config file for the calling application. If you use this assembly in a Script Task, and execute your package through DTExec, then you need to create a DTExec.config file, with suitable entries.

Other hosts of interest will be DtsDebugHost.exe , DtsHost.exe, DtExecUI.exe

|||

I have done in the same way. I added the assemblies in GAC that are using Enterprise libraries and then I am refering those dlls in my SSIS package.

Now you are saying that for configuration I need to create a DTExec.Config file. I am not able to understand how i should define my configuration setttings in this config file.

What I did is as my configuration file is like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add name="abc" providerName="System.Data.SqlClient" connectionString="Data Source=[Server Name];Initial Catalog=[Database Name];User ID=; password=" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

So I created one Connection manager named "abc" for that package and then in package configuration I made the configuration settings like

<DTSConfiguration

<Configuration ConfiguredType="Property" Path="\Package.Connections[abc].Properties[ConnectionString]" ValueType="String">

<ConfiguredValue>Data Source=[server name];User ID=;Initial Catalog=[database name];</ConfiguredValue>

</Configuration>

</DTSConfiguration>

I have config file named app.config in which i have added only configuration settings for EnLib like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

then I executed it through dtExec like this

EXEC xp_cmdshell 'dtexec /conf "C:\App.Config" /f "C:\Package1.dtsx"'

On executing this I get the exception in code. This exception is coming because it is not able to access the data layer. If I comment the code in which it is accessing database then it work ok.

Please help me. Problem is in configuration file only.

Thanks,

Pooja

Custom Object in SSIS

I wrote a C# class that has a couple of methods that can be called to grab data out of a flat file and import it to a DB. This class was written for a web applicaiton originally. (class has many complex business rules in it)

Now I would like to use this same class in a SSIS package.

Is it possible in a script task to create a new object with my class and use it's methods?

In the end all I want SSIS to do is create my object, call a method in that object and be done.

If I was doing this in DTS, I would have to create an .Net EXE that used my class but I'm hoping to avoid that in SSIS.

Frenchy

The simplest way would be to use the class as-is, and just reference it from a Script Task, which gives you a VB.Net environment to create your class and call your methods as required. You can also leverage connections and variables for a more integrated and dynamic approach if required. You will need to place your assembly in a defined folder to get the Add Reference to work on VSA, the script environment used by SSIS - http://msdn2.microsoft.com/en-us/library/ms136007.aspx|||

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

|||

Pooja B wrote:

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

Darren answered this question already (above). Is anythig not clear?

-Jamie

|||

Thanks Jamie. No its clear but I am totally new to SSIS so dont have that much understanding. Can you send me some sample code that is accessing already existing classes in Script task.

Thank you so much...

Pooja

|||If you follow the steps in Darren's post (adding a reference to the .dll that holds your custom code), then you just create a new instance of the object and begin using it - just like you would in any .NET code.|||

For adding a reference to required dlls we need to make them strongly typed. I made them strongly typed and added them to ../windows/microsoft.net/framework/2.0.., then I am able to run my code sucessfully but could not access these dlls in SSIS package. When I add these dlls in GAC then I could access the dlls in SSIS packages but then my application starts giving errors as it gould not refer some of the dlls because of making it strongly named. Can you please suggest what could be the problem. I am using microsoft enterprise libraries in my code.

Thanks,

Pooja

|||This is really a question for a different forum - you might try one of the groups under .NET Development.|||

PLEASE help us to help you-

What application gives these errors?

What are the errors?

An existing application that referenced non-strong named assemblies should keep working fine, assuming you have left the old assemblies in place. It would however make senses to updae your code to use the new strong named version so that all code, SSIS and other applictions, share the same common assemblies.

|||

Thanks for your reply. I am able to fix that problem. In my appplication as I strongly named the assemblies, it was not able to find that in GAC so i need to change that in my app.config file.

I am new to SSIS, Can you please tell me how to specify configuration settings for SSIS. Like my cofiguration settings are like this.

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add

name="abc_Dev"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=" />

<add

name="abc_Prod"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=;" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc_Dev"/>

</configuration>

Thanks,

Pooja

|||Take a look at "Package Configurations" in SQL Server Books Online.|||

I have a similar scenario - EntLib and SSIS. I'm afraid I haven't found a way to use the same configuration file - both SSIS and EntLib have their own ideas about file format.

What I do is to manage the EntLib configuration files in the usual way (as in your code example above); and for the SSIS packages I use XML package configurations. You can find out more about these at http://msdn2.microsoft.com/en-us/library/ms141682.aspx.

|||

I specified the database configuration like this but how to specify the configsections for EntLib in XML configuration secion.

<DTSConfiguration>
<Configuration
ConfiguredType="Property"
Path="\Package.Connections[ConnectionName].Properties[ConnectionString]"
ValueType="String">
<ConfiguredValue>

Data Source=[Server Name];

User ID=[user name];

Initial Catalog=[database name];

</ConfiguredValue>
</Configuration>

</DTSConfiguration>

Can you please show me the dtsconfig xml file that you used in your application.

Thanks,

Pooja

|||

SSIS configurations and Enterprise Library configurations are clearly not the same, SSIS has no concept of .Net configurations. You will never be able to get SSIS to use Ent Lib config sections.

The best you can ever do is get .Net code hosted in SSIS to use Ent Lib config. This is not the same as making SSIS use Ent Lib or it's config, this is using .Net code. This is important if you have managed code, that uses Ent Lib functions. As covered above, to use external (external to SSIS I mean) assemblies, you need to ensure they are in the GAC, a challenge for first time Ent Lib builds.

For the configuration, think about how any .Net config works, the host process is responsible for loading it. So if you write an assembly which calls Microsoft.Practices.EnterpriseLibrary.ExceptionHandling stuff, and you want the exceptionHandling\exceptionPolicies config stuff to be available, then you need to add that to the config file for the calling application. If you use this assembly in a Script Task, and execute your package through DTExec, then you need to create a DTExec.config file, with suitable entries.

Other hosts of interest will be DtsDebugHost.exe , DtsHost.exe, DtExecUI.exe

|||

I have done in the same way. I added the assemblies in GAC that are using Enterprise libraries and then I am refering those dlls in my SSIS package.

Now you are saying that for configuration I need to create a DTExec.Config file. I am not able to understand how i should define my configuration setttings in this config file.

What I did is as my configuration file is like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add name="abc" providerName="System.Data.SqlClient" connectionString="Data Source=[Server Name];Initial Catalog=[Database Name];User ID=; password=" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

So I created one Connection manager named "abc" for that package and then in package configuration I made the configuration settings like

<DTSConfiguration

<Configuration ConfiguredType="Property" Path="\Package.Connections[abc].Properties[ConnectionString]" ValueType="String">

<ConfiguredValue>Data Source=[server name];User ID=;Initial Catalog=[database name];</ConfiguredValue>

</Configuration>

</DTSConfiguration>

I have config file named app.config in which i have added only configuration settings for EnLib like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

then I executed it through dtExec like this

EXEC xp_cmdshell 'dtexec /conf "C:\App.Config" /f "C:\Package1.dtsx"'

On executing this I get the exception in code. This exception is coming because it is not able to access the data layer. If I comment the code in which it is accessing database then it work ok.

Please help me. Problem is in configuration file only.

Thanks,

Pooja

Custom Object in SSIS

I wrote a C# class that has a couple of methods that can be called to grab data out of a flat file and import it to a DB. This class was written for a web applicaiton originally. (class has many complex business rules in it)

Now I would like to use this same class in a SSIS package.

Is it possible in a script task to create a new object with my class and use it's methods?

In the end all I want SSIS to do is create my object, call a method in that object and be done.

If I was doing this in DTS, I would have to create an .Net EXE that used my class but I'm hoping to avoid that in SSIS.

Frenchy

The simplest way would be to use the class as-is, and just reference it from a Script Task, which gives you a VB.Net environment to create your class and call your methods as required. You can also leverage connections and variables for a more integrated and dynamic approach if required. You will need to place your assembly in a defined folder to get the Add Reference to work on VSA, the script environment used by SSIS - http://msdn2.microsoft.com/en-us/library/ms136007.aspx|||

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

|||

Pooja B wrote:

I also need the same. My code is in C# and that could not be converted in VB.NET. Did you find any way to invoke C# class ? Please let me know also If you find any solution.

Thanks,

Pooja

Darren answered this question already (above). Is anythig not clear?

-Jamie

|||

Thanks Jamie. No its clear but I am totally new to SSIS so dont have that much understanding. Can you send me some sample code that is accessing already existing classes in Script task.

Thank you so much...

Pooja

|||If you follow the steps in Darren's post (adding a reference to the .dll that holds your custom code), then you just create a new instance of the object and begin using it - just like you would in any .NET code.|||

For adding a reference to required dlls we need to make them strongly typed. I made them strongly typed and added them to ../windows/microsoft.net/framework/2.0.., then I am able to run my code sucessfully but could not access these dlls in SSIS package. When I add these dlls in GAC then I could access the dlls in SSIS packages but then my application starts giving errors as it gould not refer some of the dlls because of making it strongly named. Can you please suggest what could be the problem. I am using microsoft enterprise libraries in my code.

Thanks,

Pooja

|||This is really a question for a different forum - you might try one of the groups under .NET Development.|||

PLEASE help us to help you-

What application gives these errors?

What are the errors?

An existing application that referenced non-strong named assemblies should keep working fine, assuming you have left the old assemblies in place. It would however make senses to updae your code to use the new strong named version so that all code, SSIS and other applictions, share the same common assemblies.

|||

Thanks for your reply. I am able to fix that problem. In my appplication as I strongly named the assemblies, it was not able to find that in GAC so i need to change that in my app.config file.

I am new to SSIS, Can you please tell me how to specify configuration settings for SSIS. Like my cofiguration settings are like this.

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add

name="abc_Dev"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=" />

<add

name="abc_Prod"

providerName="System.Data.SqlClient"

connectionString="Data Source=;Initial Catalog=;User ID=; Password=;" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc_Dev"/>

</configuration>

Thanks,

Pooja

|||Take a look at "Package Configurations" in SQL Server Books Online.|||

I have a similar scenario - EntLib and SSIS. I'm afraid I haven't found a way to use the same configuration file - both SSIS and EntLib have their own ideas about file format.

What I do is to manage the EntLib configuration files in the usual way (as in your code example above); and for the SSIS packages I use XML package configurations. You can find out more about these at http://msdn2.microsoft.com/en-us/library/ms141682.aspx.

|||

I specified the database configuration like this but how to specify the configsections for EntLib in XML configuration secion.

<DTSConfiguration>
<Configuration
ConfiguredType="Property"
Path="\Package.Connections[ConnectionName].Properties[ConnectionString]"
ValueType="String">
<ConfiguredValue>

Data Source=[Server Name];

User ID=[user name];

Initial Catalog=[database name];

</ConfiguredValue>
</Configuration>

</DTSConfiguration>

Can you please show me the dtsconfig xml file that you used in your application.

Thanks,

Pooja

|||

SSIS configurations and Enterprise Library configurations are clearly not the same, SSIS has no concept of .Net configurations. You will never be able to get SSIS to use Ent Lib config sections.

The best you can ever do is get .Net code hosted in SSIS to use Ent Lib config. This is not the same as making SSIS use Ent Lib or it's config, this is using .Net code. This is important if you have managed code, that uses Ent Lib functions. As covered above, to use external (external to SSIS I mean) assemblies, you need to ensure they are in the GAC, a challenge for first time Ent Lib builds.

For the configuration, think about how any .Net config works, the host process is responsible for loading it. So if you write an assembly which calls Microsoft.Practices.EnterpriseLibrary.ExceptionHandling stuff, and you want the exceptionHandling\exceptionPolicies config stuff to be available, then you need to add that to the config file for the calling application. If you use this assembly in a Script Task, and execute your package through DTExec, then you need to create a DTExec.config file, with suitable entries.

Other hosts of interest will be DtsDebugHost.exe , DtsHost.exe, DtExecUI.exe

|||

I have done in the same way. I added the assemblies in GAC that are using Enterprise libraries and then I am refering those dlls in my SSIS package.

Now you are saying that for configuration I need to create a DTExec.Config file. I am not able to understand how i should define my configuration setttings in this config file.

What I did is as my configuration file is like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<connectionStrings>

<add name="abc" providerName="System.Data.SqlClient" connectionString="Data Source=[Server Name];Initial Catalog=[Database Name];User ID=; password=" />

</connectionStrings>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

So I created one Connection manager named "abc" for that package and then in package configuration I made the configuration settings like

<DTSConfiguration

<Configuration ConfiguredType="Property" Path="\Package.Connections[abc].Properties[ConnectionString]" ValueType="String">

<ConfiguredValue>Data Source=[server name];User ID=;Initial Catalog=[database name];</ConfiguredValue>

</Configuration>

</DTSConfiguration>

I have config file named app.config in which i have added only configuration settings for EnLib like this

<configuration>

<configSections>

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, MSEntLib.Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken=1791fdccf49453e7" />

</configSections>

<dataConfiguration defaultDatabase="abc"/>

</configuration>

then I executed it through dtExec like this

EXEC xp_cmdshell 'dtexec /conf "C:\App.Config" /f "C:\Package1.dtsx"'

On executing this I get the exception in code. This exception is coming because it is not able to access the data layer. If I comment the code in which it is accessing database then it work ok.

Please help me. Problem is in configuration file only.

Thanks,

Pooja

Saturday, February 25, 2012

Custom Data Extension to SQL Server

Where I work we have custom code to retrieve the connection string. Theprogrammer provides a role and a mode and a connection object isretured. I need similar functionality from Reporting Services and I'mnot sure where to start. I was thinking of passing the role and mode inas username and password under credentials and being able to use thisas my connection to get data for reports. Any help in solving thisproblem would be greatly appreciated.

SQL Server Reporting services is part of SQL Server so you can create roles either with stored procedure or under permissions in Enterprise manager. Hope this helps.

Kind regards,

Gift Peddie

|||Sorry but you did not understand my post. Please read before replying.As I said we have custom code that we pass a role and mode to that willgive us the CONNECTIONSTRING.
Ryan
|||

Sorry maybe the link below could help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod12.asp

Kind regards,

Gift Peddie

|||I have figured it out and that link doesn't relate to the problem.
I figured out how to do a custom data extension but I am getting astack overflow exception when I try using the extension. I am alsogetting a SecurityPermission exception when I try calling a functionthat uses interop code. So anyone with any ideas to either of theseproblems would be appreciated.
Ryan

Sunday, February 19, 2012

Custom Assembly Using System.Web.Security.FormAuthenticationTicket

We have created a custom assembly that creates a
FormAuthenticationTicket object. When calling the custom assembly from
an expression for "Jump to URL", the preview returns "Invalid URI: The
hostname could not be parsed" error message.
The FormsAuthenticationTicket is in System.Web.Security, which is
within the System.Web.dll that I have added a reference to within the
report designer.
If I comment out the FormsAuthenticationTicket lines in the custom
assembly, previewing the report runs just fine.
My question is: what do I need to do to get the Report Designer to have
the ability to create the FormsAuthenticationTicket?
Thanks,
NateI should note that the FormsAuthenticationTicket object is used in the
method, but we are returning a string from the method, not the ticket
object itself.
The problem boils down to the fact that ReportServices can not find
System.Web.Security, which is in System.Web referenced within the
report.
Thanks,
Nate|||Sending up the white flag...
I have switched from custom assembly to custom code (Code Tab in Report
Properties). Here's the code:
---
Public Function GetDetailReportUrl(ByVal strUrl As String) As String
'Dim objTkt As System.Web.Security.FormsAuthenticationTicket
Dim strTkt As String
Dim strTktData As String
Dim intVersion As Int32
Dim strName As String
Dim dtIssued As DateTime
Dim dtExpiry As DateTime
Dim bIsPersistent As Boolean
Dim strUserData As String
strTktData = strUrl + "|" + DateTime.Now.AddHours(1).ToString()
intVersion = 1
strName = "ruser"
dtIssued = DateTime.Now
dtExpiry = DateTime.Now.AddMinutes(30)
bIsPersistent = False
strUserData = strTktData
Try
Dim objTkt as System.Web.Security.FormsAuthenticationTicket
= New System.Web.Security.FormsAuthenticationTicket(intVersion,
strName, dtIssued, dtExpiry, bIsPersistent,strUserData)
'strTkt =System.Web.Security.FormsAuthentication.Encrypt(objTkt)
Catch ex As Exception
strUrl = strUrl & "&error=" & ex.ToString
Finally
strUrl = strUrl & "&tkt=" & strTkt
End Try
GetDetailReportUrl = strUrl
End Function
---
It is failing when I am trying to instantiate the
FormsAuthenticationTicket. If I comment out the lines pertaining to
objTkt and the Encrypt() call, but leave the declaration of objTkt, no
problems.
Here's the error:
System.NullReferenceException: Object reference not set to an instance
of an
object.
at System.Web.Security.FormsAuthentication.Initialize()
at System.Web.Security.FormsAuthenticationTicket..ctor(Int32 version,
String name, DateTime issueDate, DateTime
expiration, Boolean isPersistent, String userData)
The problem is with the FormsAuthenticationTicket constructor calling
FormsAuthentication.Initialize(). It's as if the constructor either
can't create the FormsAuthentication object, or is trying to access an
object it thinks already exists.
Any help out there?
- Nate