Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Wednesday, March 21, 2012

LogonUser

Hi All,
There is anyone that have a sample code (working) that show how to use the
LogonUser API?
Thank youdarkeagle wrote:
> There is anyone that have a sample code (working) that show how to
> use the LogonUser API?
Via SOAP?
regards
Frank|||Hi,
Thank you,
Consider this example:
// instantiate a new Web service proxy
RSClient rs = new RSClient();
// Pass credentials from the user
NetworkCredential creds = rs.GetCredentials();
rs.LogonUser(creds.UserName, creds.Password, null);
RSClient is a webservice instance pointing to a reporting services
enterprise edition server.
When i call rs.LogonUser I obtain: "This function is not supported from this
version of reporting services" But the enerprise edition support this API
Call!
I found a sample at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_ref_soapapi_service_lz_3d7q.asp
Thank you
"Frank Matthiesen" <fm@.xax.de> ha scritto nel messaggio
news:3bv4s3F6h2087U1@.individual.net...
> darkeagle wrote:
>> There is anyone that have a sample code (working) that show how to
>> use the LogonUser API?
> Via SOAP?
> regards
> Frank
>|||Make sure you have Enterprise (or Developer) edition. Standard edition does
not support custom security extensions. Go to the <whereever you installed
RS>\LogFiles folder. Open one of the <ReportServerService__...>.log files
and look for a line like this:
ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i INFO:
Reporting Services starting SKU: Enterprise
Make sure you don't have standard. Also, notice what BOL states about
LogonUser:
LogonUser must be called over SSL. The method fails if it is not called
securely.
--
Adrian M.
MCP
"darkeagle" <darkeagle@.nospam.it> wrote in message
news:ulmDMooPFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Thank you,
> Consider this example:
> // instantiate a new Web service proxy
> RSClient rs = new RSClient();
> // Pass credentials from the user
> NetworkCredential creds = rs.GetCredentials();
> rs.LogonUser(creds.UserName, creds.Password, null);
> RSClient is a webservice instance pointing to a reporting services
> enterprise edition server.
> When i call rs.LogonUser I obtain: "This function is not supported from
> this version of reporting services" But the enerprise edition support this
> API Call!
> I found a sample at:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_ref_soapapi_service_lz_3d7q.asp
> Thank you
> "Frank Matthiesen" <fm@.xax.de> ha scritto nel messaggio
> news:3bv4s3F6h2087U1@.individual.net...
>> darkeagle wrote:
>> There is anyone that have a sample code (working) that show how to
>> use the LogonUser API?
>> Via SOAP?
>> regards
>> Frank
>>
>|||Hi,
Thank you for your response
> ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i
> INFO: Reporting Services starting SKU: Enterprise
This is OK,
> LogonUser must be called over SSL. The method fails if it is not called
> securely.
Ah, it is. I'm not sure if I calling LogonUser over SSL... Have you a sample
code to give me?
Thank you very much.
D|||Hi,
As you can see from my next log file, the release of reporting services is
the enterprise and after the logonuser call come the generation of the
OperationNotSupportedException
This is a dump of my report server log file:
aspnet_wp!resourceutilities!bbc!4/11/2005-17:26:54:: i INFO: Reporting
Services starting SKU: Enterprise
aspnet_wp!runningjobs!bbc!4/11/2005-17:26:54:: i INFO: Database Cleanup (Web
Service) timer enabled: Cycle: 600 seconds
aspnet_wp!runningjobs!bbc!4/11/2005-17:26:54:: i INFO: Running Requests
Scavenger timer enabled: Cycle: 60 seconds
aspnet_wp!runningjobs!bbc!4/11/2005-17:26:54:: i INFO: Running Requests DB
timer enabled: Cycle: 60 seconds
aspnet_wp!runningjobs!bbc!4/11/2005-17:26:54:: i INFO: Memory stats update
timer enabled: Cycle: 60 seconds
aspnet_wp!crypto!b94!4/11/2005-17:27:54:: i INFO: Initializing crypto as
user: DINO\ASPNET
aspnet_wp!crypto!b94!4/11/2005-17:27:54:: i INFO: Exporting public key
aspnet_wp!crypto!b94!4/11/2005-17:27:54:: i INFO: Performing sku validation
aspnet_wp!crypto!b94!4/11/2005-17:27:54:: i INFO: Importing existing
encryption key
aspnet_wp!library!974!04/11/2005-17:36:10:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException:
This operation is not supported in this edition of Reporting Services, ;
Info:
Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException:
This operation is not supported in this edition of Reporting Services
aspnet_wp!library!c60!4/11/2005-17:36:54:: i INFO: Cleaned 0 batch records,
0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running
jobs
aspnet_wp!library!974!04/11/2005-17:37:00:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException:
This operation is not supported in this edition of Reporting Services, ;
Info:
Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException:
This operation is not supported in this edition of Reporting Services
"Adrian M." <absolutelynospam@.nodomain_.com> ha scritto nel messaggio
news:%23Dgs0JpPFHA.2252@.TK2MSFTNGP15.phx.gbl...
> Make sure you have Enterprise (or Developer) edition. Standard edition
> does not support custom security extensions. Go to the <whereever you
> installed RS>\LogFiles folder. Open one of the
> <ReportServerService__...>.log files and look for a line like this:
> ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i
> INFO: Reporting Services starting SKU: Enterprise
> Make sure you don't have standard. Also, notice what BOL states about
> LogonUser:
> LogonUser must be called over SSL. The method fails if it is not called
> securely.
> --
> Adrian M.
> MCP
>
> "darkeagle" <darkeagle@.nospam.it> wrote in message
> news:ulmDMooPFHA.2604@.TK2MSFTNGP10.phx.gbl...
>> Hi,
>> Thank you,
>> Consider this example:
>> // instantiate a new Web service proxy
>> RSClient rs = new RSClient();
>> // Pass credentials from the user
>> NetworkCredential creds = rs.GetCredentials();
>> rs.LogonUser(creds.UserName, creds.Password, null);
>> RSClient is a webservice instance pointing to a reporting services
>> enterprise edition server.
>> When i call rs.LogonUser I obtain: "This function is not supported from
>> this version of reporting services" But the enerprise edition support
>> this API Call!
>> I found a sample at:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_ref_soapapi_service_lz_3d7q.asp
>> Thank you
>> "Frank Matthiesen" <fm@.xax.de> ha scritto nel messaggio
>> news:3bv4s3F6h2087U1@.individual.net...
>> darkeagle wrote:
>> There is anyone that have a sample code (working) that show how to
>> use the LogonUser API?
>> Via SOAP?
>> regards
>> Frank
>>
>>
>|||The code stays the same. This just requires a certificate be installed on
the Reporting Services server.
You will have to modify the SecureConnectionLevel setting in the
RSReportServicer.config file. See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_soapapi_dev_2xiq.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sslsetup.asp
to get you started.
--
Adrian M.
MCP
"darkeagle" <darkeagle@.nospam.it> wrote in message
news:uRXvx7pPFHA.3076@.tk2msftngp13.phx.gbl...
> Hi,
> Thank you for your response
>> ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i
>> INFO: Reporting Services starting SKU: Enterprise
> This is OK,
>> LogonUser must be called over SSL. The method fails if it is not called
>> securely.
> Ah, it is. I'm not sure if I calling LogonUser over SSL... Have you a
> sample code to give me?
> Thank you very much.
> D
>|||Hi,
Thank you for your response.
I already had SecureConnectionLevel =0 in my config file and I tryed to call
LogonUser over a non SSL connection.
In fact, if you read my last post, the error returned from rs is a
OperationNotSupportedException!!!
You know why this error? I have installed the enterprise edition...!
"Adrian M." <absolutelynospam@.nodomain_.com> ha scritto nel messaggio
news:%23OkYi91PFHA.2972@.TK2MSFTNGP14.phx.gbl...
> The code stays the same. This just requires a certificate be installed on
> the Reporting Services server.
> You will have to modify the SecureConnectionLevel setting in the
> RSReportServicer.config file. See:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_soapapi_dev_2xiq.asp
> and
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sslsetup.asp
> to get you started.
> --
> Adrian M.
> MCP
>
> "darkeagle" <darkeagle@.nospam.it> wrote in message
> news:uRXvx7pPFHA.3076@.tk2msftngp13.phx.gbl...
>> Hi,
>> Thank you for your response
>> ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i
>> INFO: Reporting Services starting SKU: Enterprise
>> This is OK,
>> LogonUser must be called over SSL. The method fails if it is not called
>> securely.
>> Ah, it is. I'm not sure if I calling LogonUser over SSL... Have you a
>> sample code to give me?
>> Thank you very much.
>> D
>|||No. I don't know why you are getting that error. Sounds like a bad
install. My suggestion is to un-install and re-install. The Enterprise
edition does support security extensions (I know, I've used it).
--
Adrian M.
MCP
"darkeagle" <darkeagle@.nospam.it> wrote in message
news:OP3MlE4PFHA.1932@.tk2msftngp13.phx.gbl...
> Hi,
> Thank you for your response.
> I already had SecureConnectionLevel =0 in my config file and I tryed to
> call LogonUser over a non SSL connection.
> In fact, if you read my last post, the error returned from rs is a
> OperationNotSupportedException!!!
> You know why this error? I have installed the enterprise edition...!
>
> "Adrian M." <absolutelynospam@.nodomain_.com> ha scritto nel messaggio
> news:%23OkYi91PFHA.2972@.TK2MSFTNGP14.phx.gbl...
>> The code stays the same. This just requires a certificate be installed
>> on the Reporting Services server.
>> You will have to modify the SecureConnectionLevel setting in the
>> RSReportServicer.config file. See:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_soapapi_dev_2xiq.asp
>> and
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sslsetup.asp
>> to get you started.
>> --
>> Adrian M.
>> MCP
>>
>> "darkeagle" <darkeagle@.nospam.it> wrote in message
>> news:uRXvx7pPFHA.3076@.tk2msftngp13.phx.gbl...
>> Hi,
>> Thank you for your response
>> ReportingServicesService!resourceutilities!c50!4/11/2005-02:54:42:: i
>> INFO: Reporting Services starting SKU: Enterprise
>> This is OK,
>> LogonUser must be called over SSL. The method fails if it is not called
>> securely.
>> Ah, it is. I'm not sure if I calling LogonUser over SSL... Have you a
>> sample code to give me?
>> Thank you very much.
>> D
>>
>

Monday, March 19, 2012

Logon Problem - I am an idiot "ID 10 T"

Tried using webmatrix code builder to simply bind a web grid to a sql table.
Works great in WEbMatrix, but when I move the code to Visual Studio.VB,
I get a logon error when the code is run.

Any Help is Greatly Appreciated... I am stuck....

Here is the code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

DataGrid1.DataSource = GetCustomers()
DataGrid1.DataBind()

End Sub

Private Function GetCustomers() As System.Data.SqlClient.SqlDataReader

Dim connectionString As String = "server='localhost'; trusted_connection=true; Database='ASPExamples'"
Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "SELECT [Customers].* FROM [Customers]"
Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)

sqlConnection.Open()
Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

Return dataReader

End Function

End ClassProblem is solved,

It was SQL Server Security, I had to add a user <Machine Name\ASPNET>
..and explicitly give permissions for SELECT, UPDATE, Etc...

Funny, but the same exact code in WEB MATRIX did not require this to be done.

Any insight on this please respond....

Logon Failed

Hi!

Please check out my code. I get this error when I 'CRViewer.ViewReport' is called.

Logon failed.
Details: ADO Error Code: 0x80030020
Source: MS OLE DB Service Components
Description: A share violation has occured

The code is pretty simple and basic. Is there anything missing or something I didn't declare?

Thanks a lot!

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

Dim crxApp As New CRAXDRT.Application
Dim crxRep As CRAXDRT.Report
Dim crxDBTable As CRAXDRT.DatabaseTable
Dim crxDB As CRAXDRT.Database
Dim crxConn As CRAXDRT.ConnectionProperty

On Error GoTo ERROR_HANDLER

DoEvents
Screen.MousePointer = vbHourglass

Do
DoEvents

If CBox.GetPrinterJobs(TReport.DeviceName) <= 2 Then
Exit Do
End If
Loop

Select Case UCase(TReport.reportName)
Case "PASTDUE_SCHEDULE"
strFilename = "PDOSchedule"

Case "PASTDUE_CURRENT"
strFilename = "PDOCurrent"

Case "PASTDUE_30DAYS"
strFilename = "PDO30Days"

Case "PASTDUE_ACTIVE"
strFilename = "PDOActive"

Case "PASTDUE_SUSPENDED"
strFilename = "PDOSuspended"

Case "PASTDUE_CANCELLED"
strFilename = "PDOCancelled"

Case "PASTDUE_ABC"
strFilename = "PDOABCEmployees"

End Select

' Open crystal report printjob and get number of parameters
strFilename = UCase(App.Path & "\Reports\" & strFilename & ".rpt")
strMessage = TPastDue.Message

' Open the report
Set crxRep = crxApp.OpenReport(strFilename)

' Set database location
Set crxDBTable = crxRep.Database.Tables(1)
crxDBTable.Location = CBox.IniFileRead("Database", "Name")

' Pass parameters to report
With crxRep.ParameterFields
For i = 1 To .Count
For j = 0 To .Count - 1
If Trim(UCase(.Item(i).parameterFieldName)) = Trim(UCase(TReport.Parameters(j, 0))) Then
.Item(i).AddCurrentValue TReport.Parameters(j, 1)
Exit For
End If
Next
Next
End With

' Set printer settings
With TReport
crxRep.SelectPrinter .DriverName, .DeviceName, .Port
End With

' Set selection formula
If TReport.Filter <> "" Then
crxRep.RecordSelectionFormula = TReport.Filter
End If

Screen.MousePointer = vbDefault

With frmReportPreview.CRViewer
.ReportSource = crxRep
.ViewReport
End WithDear Questioner, Please use logon properties.

Dim Application As New CRAXDRT.Application

Dim report As CRAXDRT.report

Dim tbl As CRAXDRT.DatabaseTable
Set report = Application.OpenReport("E:\NAD\rptItemSearch.rpt")

Set tbl = report.Database.Tables(1)

tbl.ConnectionProperties("Data Source") = "SQLSERVER"
tbl.ConnectionProperties("Initial Catalog") = "Hilbro"
tbl.ConnectionProperties("User ID") = "Wajid"
tbl.ConnectionProperties("Password") = "WSBis#1"

frmItemReport.CRViewer.ReportSource = report

frmItemReport.CRViewer.ViewReport

frmItemReport.Show

I hope this will help.

logon failed

hi
i am using crystal reports9 in vb6 with access database.

i Created one report called rep_customer
and wroted code on button_click event to call report from vb

vbcode---------------

public sub cust_report_button_click
connect
Set r = New ADODB.Recordset
ReportNameVar = App.Path & "\reports\rep_customers.rpt"
r.Open "select * from cust ", c, adOpenDynamic, adLockOptimistic
Set report = crxApplication.OpenReport(ReportNameVar, 1)
report.Database.SetDataSource r
CRViewer91.ReportSource = report
Rep_form.ViewReport
Rep_form.Show
End Sub
------------------

it;s working fine

i created one more report Called Purchase_order based
on two tables (purchase_order,purchase_order_details)
and wroted code on button_click event to call report from vb

vbcode---------------

public sub Purchase_report_button_click
connect
Set r = New ADODB.Recordset
ReportNameVar = App.Path & "\reports\rep_purchase.rpt"

r.Open "select Purchase_order.pono,purchase_order.date,
Purchase_order_details.Product_code ,Purchase_order_details.product_description
from purchase_order,purchase_order_details
where purchase_order.pono=purchase_order_details.pono ", c, adOpenDynamic, adLockOptimistic

Set report = crxApplication.OpenReport(ReportNameVar, 1)
report.Database.SetDataSource r
CRViewer91.ReportSource = report
Rep_form.ViewReport
Rep_form.Show
End Sub
---------------------
i am getting error like
logon failed
Details:Ado Error Code 0x80040e4d
Microsoft Jet Database Engine
Description not a valid password
sql stated 3031

Report is working fine in Desiging and Preview of Crystal Designer Environment
i am sure no problem in database connection username and password
because i am using same connection for customer report.

i hope Only the Problem while Calling from vb6 when report having 2 tables
Where is the Problem ?how Can i solve this One
Can Any one Help meOpen the report and Do verify Database

Wednesday, March 7, 2012

Login SQL Server using Integrated Security ! Problem

ok thi is my code for test

SqlConnection conn = new SqlConnection("server=majed13;Integrated Security=SSPI;");
conn.Open();
conn.Close();

connection isOK
the user logged in SQL Server isASPNET USER
i want looged in currentNT USER not ASPNET USER
thanx in advanceIt get the current user, you can use impersonation, and disable anonymous access to the Web. Is this on an Intranet? Do all users have rights to SQL Server? Is there a domain in place?|||Is this on an Intranet?Yes
Do all users have rights to SQL Server?Yes
Is there a domain in place?Yes


the problem in current user it's take the ASPNET not NT USER why ??
|||aspnet is the default iis user. Your best bet is to utilize ASP.NET's impersonation abilities in the web.config.

http://msdn.microsoft.com/library/en-us/vsent7/html/vxconImpersonation.asp?frame=true

that should explain a lot of it for you.

Either that, or utilize a DAL or stop using Integrated Security. :)|||the answer is


<identity impersonate="true" />

thank you