Prevent Edit of Connection string

Stimulsoft Reports.NET discussion
Post Reply
admin@secsol.co.uk
Posts: 70
Joined: Wed Jun 01, 2022 8:26 am

Prevent Edit of Connection string

Post by admin@secsol.co.uk »

In the report designer it is possible for the end user to edit the data connection string (ODBC) this is obviously a security risk as they can then see the login details etc.

In the web version I can prevent the end user from editing the connection string by doing this :

Code: Select all

 options.Dictionary.PermissionDataConnections = StiDesignerPermissions.View;
I have tried to do the same thing with my Windows program using this code that I found in another thread :

Code: Select all

  SelectedReport.SReport.Dictionary.Restrictions.Add("Cypher1", StiDataType.Database, StiRestrictionTypes.DenyEdit);
  StiOptions.Designer.CodeTabVisible = false;
However, this doesn't prevent the end user from editing the connection string.

How do I achieve the same thing as the web application in making the data connection read only?
Max Shamanov
Posts: 1090
Joined: Tue Sep 07, 2021 10:11 am

Re: Prevent Edit of Connection string

Post by Max Shamanov »

Hello,

Could you please send us a sample project that reproduces the issue?

Thank you.
admin@secsol.co.uk
Posts: 70
Joined: Wed Jun 01, 2022 8:26 am

Re: Prevent Edit of Connection string

Post by admin@secsol.co.uk »

It is okay, I have found the problem.

I was setting the Dictionary Restriction before I had added the Cypher1 data source - I have to set it afterwards.
Max Shamanov
Posts: 1090
Joined: Tue Sep 07, 2021 10:11 am

Re: Prevent Edit of Connection string

Post by Max Shamanov »

Hello.

Ok.
Let us know if you need our help.

Thank you.
Evangeline
Posts: 4
Joined: Tue Mar 04, 2025 9:48 am

Re: Prevent Edit of Connection string

Post by Evangeline »

admin@secsol.co.uk wrote: Fri Oct 17, 2025 8:46 am In the report designer it is possible for the end user to edit the data connection string (ODBC) this is obviously a security risk as they can then see the login details etc.

In the web version I can prevent the end user from editing the connection string by doing this :

Code: Select all

 options.Dictionary.PermissionDataConnections = StiDesignerPermissions.View;
I have tried to do the same thing with my Windows program using this code that I found in another thread :

Code: Select all

  SelectedReport.SReport.Dictionary.Restrictions.Add("Cypher1", StiDataType.Database, StiRestrictionTypes.DenyEdit); 
  StiOptions.Designer.CodeTabVisible = false;
slope
However, this doesn't prevent the end user from editing the connection string.

How do I achieve the same thing as the web application in making the data connection read only?
Why does the approach used in the web version to restrict editing of the data connection string not work in the Windows application, despite using similar permission settings?
Lech Kulikowski
Posts: 7634
Joined: Tue Mar 20, 2018 5:34 am

Re: Prevent Edit of Connection string

Post by Lech Kulikowski »

Hello,

In the .NET and Web versions, these settings are slightly different.
For the web designer, you should use Permissions:
https://www.stimulsoft.com/en/documenta ... ttings.htm

Thank you.
Post Reply