i'm developing an outlook plug in where users set a list of settings like credentials and site url...
I'am saving this settings in settings.settings in my windows application project.
after installing the add in the config file is set under C:\Users\ user \AppData\Local\Microsoft_Corporation\ project name \ * < outlook Version> * \user.config.
My problem is when performing update for the microsoft office outlook the outlook version changed so my add in will not be able to find the user settings.
How can i pass this problem???
Is it the best practice to save the user settings in settings.settings file?
When I ran into a similar problem a while back, I found this page helpful: http://www.devx.com/dotnet/Article/33944/0/page/4.
It basically requires calling:
<your assembly>.Properties.Settings.Default.Upgrade();
I remember that there is a My.Settings.Upgrade method, which transfers settings between assembly updates. I'd rather use an own settings class and a path about which I decide.
You can also decide to write your own upgrade routine in the case of an major application update.
Related
We have a DNN based websites being used for our company. Within that there are multiple sites among which there is a site at https://example.com/siteId25.
This particular site have been modified by any one of the Admin's in such a way that upon visiting that url, its only downloading a document(.docx) file rather then showing the website which used to be there.
The file is within the hosted website's portal folder at path "wwroot/WebsiteFolder/Portal/25/Info siteId25.docx". Upon removing that file, it starts giving error.
We already have Testing version of that site on a different server, which is serving appropriate website page upon visiting that path.
Upon checking the Site settings in the Website Persona Bar, as well as checking that in the database table Portal Settings, we didn't found any relevant settings to serve document rather then webpage.
All of the settings are having same values default values in both production & in Testing environment. We tries switching Site Alias mapping mode from canonical to direct, but issue persist.
Can anyone please tell us any to set back url to show website rather then download file?
You find the start page in the table PortalLocalization. The value in the field HomeTabId is the TabId from the table Tabs (pages were called tabs in DNN in former times).
Mind the field PortalId, and CultureCode (if you have a multilingual portal). Set the value to the TabId needed (mind the PortalId also in the table Tabs).
After changing anything in the databse, you should always restart the application pool in IIS. If you have no other way to do it, just open the web.config file with a text editor, enter a blank line, delete this line and save the file.
I have a requirement to display a user's calendar entries for the next month on a web application dashboard view.
I have successfully used Exchange Web Services to achieve this following this documentation:
https://msdn.microsoft.com/en-us/library/office/dn495614(v=exchg.150).aspx
The final requirements for this task are that if the user clicks on the entry (in their browser):
Outlook should open on their machine and take them straight to the actual calendar entry.
I've inspected the appointment objects and I can see I have access to the calendar Id and I can easily pass this to the server however from here I'm a little confused how I can launch the application that is on their machine and tell it to open that entry Id.
Would this be another EWS call or Office.Interop.Outlook, is it even possible at all?
If this makes it anymore difficult, this is a .Net Core 2.0 web application.
Outlook still accepts command line switches, one of which let's you open an Outlook item, /select.
Now you just need to create a URL to launch Outlook with your command line arguments.
For IE, this is not too difficult assuming your web application is trusted:
javascript:(new ActiveXObject('Shell.Application')).ShellExecute('outlook.exe','/select outlook:<entryid>');
For Chrome, you could send a cmd file or create a helper exe that is downloaded, but the user would have to manually pick open to launch it.
Active X will not be working for all the modern browsers like chrome, IEEdge, firefox and safari. Alternatively you can create below registry entry and anchor link/button to open the outlook calendar
below is the markup
<button id="outlookCalendarBtn" onclick="window.open('outlookwebcal:')">
Open Outlook Calendar
</button>
Create below registry entry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\outlookwebcal]
#="URL:Outlook Add Internet Calendar"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\outlookwebcal\shell]
#="open"
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open]
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open\command]
#="\"C:\\Program Files\\Microsoft Office\\root\\office16\\Outlook.exe\" /select outlook:calendar"
I have created an application using Settings from Project Properties. This setting has been used to store some boolean and string variables. I know the settings are user base. So, it can be stored separately for each windows user. I have also added a feature to update application from web server. But, recently i have notice that when i have change the product version then all the settings are get reset. It should not be. How to avoid resetting all setting on version change.
This question is not for only c#. this problem also occurred in vb.
You can try Settings.Upgrade() or ApplicationSettingsBase.GetPreviousVersion
Note: You must call only once this method.
Client Settings
What is the best practice to store application settings (such as user name and password, database location ...) in C# ?
Hint: I am new to .net and C#
Application Configuration Settings that are application wide (non-user specific) belong in either app.config (for Desktop apps) or web.config (for Web apps).
Encrypting sections of a web.config file is quite simple as outlined in this Super Simple Example.
If you need to store User specific settings (like application settings, etc.) or Application wide settings not related to application configuration you can use a Settings file as described here:
User Settings in C#
I'm not sure what version of .net/Visual Studio it was introduced in, but you can right click on your project, choose 'Add New Item' and select 'Settings File' from the "Add New Item" window. This provides your project with a (named by default) Settings.settings file that you can configure all the settings you want to expose in.
You can define settings that you create to be either Application or User which means you can use this single interface to control global and user settings. Once you've created a setting in the Settings.settings file using the editor that Visual Studio provides, you can access it in code like this:
// Get a Setting value
var valueOfSetting1 = Settings1.Default.Setting1;
// Modify and save a Setting value
Settings1.Default.Setting1 = "New Value";
Settings1.Default.Save();
First option is the registry. It is easy, but it is not too safe for passwords. Another option is using a file that you create. This too isn't safe, unless you want to implement cryption.
Next option is using the Application Settings. This is also quite simple, but there are a few catches. First, right click on your project and go to Properties. There, under the Settings tab, you can store variables to which you can access from your program by
string password = Properties.Settings.Default.Password
You can also change them the same way, but ONLY IF the scope is set the User. WHen the scope is application-wide, VS does not allow you to change these variables for some odd reason. To save changes, you must call Save() as follows:
Properties.Settings.Default.Save();
These are saved in the User Data folder under C:\Documents and Settings\'Current User'\Local Settings\Application Data\
Another option would be to include them in your database, but since you are also storing your database location, this might not work for you.
I think app.config (non web app) or web.config (web app).
These sorts of settings usually land in Application Configuration Files (web.config, app.config).
http://www.devasp.net/net/articles/display/679.html
If you are storing passwords, you might also need to encrypt the configuration section in question.
http://msdn.microsoft.com/en-us/library/53tyfkaw.aspx
http://msdn.microsoft.com/en-us/library/ff650304.aspx
Note if you use app.config, you will see it get renamed to ..config, depending on if your output produces a DLL or an EXE.
As with the above replies suggest, app.config or the web.config is the best place for app settings.
If you need a more robust way of xml style tags for database, server settings and the like, you can use the configurationSection and create custom sections.
http://www.codeproject.com/KB/cs/CustomConfigurationSectio.aspx
For database passwords, the way i do it is have an encrypted string in the xml tag value and decrypt then when reading them, that way you dont expose the passwords.
appsettings config file, ini file(nini), embeddable database(sqlite,berkelydb/etc..),whatever method you like, it depends on your application size/performance consideration and design.
We have a c# asp.net web application that, amongst other things, allows users to download previously uploaded files such as PDF's, Word docs etc. The asp.net app is served up via an IIS6 server and the file resources live on a different server.
When the user requests a file (i.e. click a button on the web form), we stream the file back to their browser, changing the ContentType appropriately.
This seemed a good way to avoid going down the IIS virtual folder route to serve up the file resources - which we had concerns about due to the potential for users to hack the URL. i.e. with a URL like https://mydomain/myresource/clientid/myreport.docx, a savvy user could have a good stab at guessing alternative cvlientid's and document names.
The trouble with streaming a Word document to the browser is that when the browser throws it at Word, Word treats it as a brand new doc, which means the original document's properties & margin info is lost.
Our users store metadata information in the Word doc properties, so this solution is not acceptable to them.
Serving up via IIS virtual folders solves that problem, but introduces the URL security problem.
So my questions are ...
Does anyone know how we can use URL encryption/decryption (or obfuscation) with IIS Virtual folders?
Or does anyone know of any open source projects that do a similar job.
Or does anyone have any sugestions on how to go about writing our own implementation of Virtual folders but with encrypted URLs?
Many thanks in advance.
ps. our web app is delivered over https
Sorry guys, in my question, I have made some incorrect assumptions.
What am I trying to do is persist the properties stored on a word document when they are delivered from server (using either Response.TransmitFile or via a virtual folder) to a client browser.
I set up a test scenario with an IIS virtual folder and dropped a docx file (that I know contains info in the title & subject properties) in my virtual folder's physical path.
I pointed my browser at the virtual folder alias and the browser popped up its message to either open or save the doc.
If I choose to save it, the saved docx still has the properties intact.
If I choose to open it fist and then save it from Word, the saved docx has lost the properties.
So I think I need to post a different question!
You may find that the ClaimsAuthorizationManager class in "Windows Identity Foundation" does what you want. You get to implement whatever logic you like to determine who can download what without using "directory security".