Computers / Programming / Mobiles (78)

05-11-2019 Alert - Before you sell or give phone to repair shop or for warranty claim. Your personal data can be recovered.
28-08-2019 Beware of phishing links, messages, Mobile apps and games.
06-10-2018 From wireframe to HTML, Design to Code - AI Power Sample
12-06-2018 Quran Kareem - Translation, Audio, Offline, Scroll - Android App
02-12-2016 MySql unicode - Arabic characters in Table columns
11-08-2016 Write arabic script shortcut, presentation in MsOffice and HTML
21-06-2014 Meet the Pakistani who is reinventing the Internet. Well kind of...
19-02-2014 Collection of e-Books and Articles on Microsoft Technologies
26-03-2013 Restore SharePoint backup from earlier to later version - Your backup is from a different version of Microsoft SharePoint Foundation and cannot be restored to a server running the current version
21-12-2012 Air bags for electronics devices
08-11-2012 Recursive Query Parent Child Concatenation
25-04-2012 Change or remove filter / filter content from Sharepoint list / library view columns
23-02-2012 Pakistani IT experts win international cyber drill
26-12-2011 Installing XP on computer with SATA hard drive
20-04-2011 Sigin as different user in asp.net using Windows authentication
26-01-2011 Powershell CmdLets
30-05-2010 Update Statistics - Query to find tables and index number of statistics being old
15-04-2010 Detail Error Message for ASP.NET at Web Hosting / Production server
15-03-2010 Passing encrypted data between JavaScript and C#
12-02-2010 Sharepoint - SPWeb.Groups Vs SPWeb.SiteGroups
28-01-2010 Accessing JD Edwards Data on iSeries or AS/400 from a ASP.NET / SQL Encoding / Error problem
28-01-2010 Controls not functional after Export to Excel or Export to PDF of Telerik in Sharepoint Application page
05-10-2009 ASP.NET Cannot open log for source {0}. You may not have write access. - Access is denied
03-09-2009 Turn off Reading pane / Auto Preview for all folders in Outlook
28-08-2009 CRM - The SELECT permission was denied on the object 'BuildVersion', database 'MicrosoftCRM_MSCRM', schema 'dbo'
25-08-2009 CRM - No authority could be contacted for authentication (Report Server)
22-08-2009 CRM - Retrieve Cultures information from CRM into your Custom Web Application
21-08-2009 CRM - Globalization / Localization in Custom Web Application
19-08-2009 CRM - Do you want to save this file? Blank.aspx?
18-08-2009 CRM Exception - Microsoft.Crm Application.Platform.Report. InternalCreate(String xml)
18-08-2009 CRM Exception - Microsoft.Crm.Reporting SRSReport.convertDataSource()
03-08-2009 Locale ID (LCID) Chart
24-06-2009 Oracle SQL Developer - Unable to create an instance of the Java Virtual Machine
17-06-2009 Busy at work
17-06-2009 Boss Menu
10-04-2009 Facebook Privacy Setting - Applications
18-03-2009 For a Software House
27-01-2009 Clock ticking on worm attack code
27-01-2009 Detecting Idle time or Inactivity in Windows Forms
27-01-2009 Values of Windows API
23-01-2009 PasswordChar and Set focus on page load for ToolStripTextBox
21-01-2009 Capture Form Close Event
21-01-2009 Richtextbox or multiline textbox and AcceptButton to handle Enter or Tab key press
21-01-2009 Key Combination shortcuts in C# Windows Form
01-01-2009 Application Architecture Guide 2 patterns and practices
01-01-2009 Convert string to hexadecimal and hexadecimal to string
31-12-2008 Implementing Transaction in Stored Procedure
31-12-2008 Implementing Transaction in .NET
25-12-2008 Linux environment in Windows
11-12-2008 Facebook Privacy Setting
27-11-2008 Pakistani group hacks Indian websites - Cyber Attack
26-10-2008 Designations...funny!
16-10-2008 Securing Your ASP.NET Web Applications
15-10-2008 Software blocks car phone users
07-10-2008 Too much in technology!
14-09-2008 Logo Evolution
13-09-2008 Difference between .NET 2.0/3.0/3.5
03-09-2008 Google launches internet browser
27-08-2008 Excel Shortcuts
16-07-2008 Quantum information technology - Enigma variations
04-07-2008 Dead Lock - Boss and Secratory
04-07-2008 Web Service Security using SOAP Extension
24-06-2008 General Web Security Consideration
24-06-2008 ASP.NET Forms Authentication
20-06-2008 Find rowcount, columncount, table size in Sql Server Database
20-06-2008 Developers
19-06-2008 Windows Shortcuts
18-06-2008 Number of Microsoft Certified Professionals Worldwide
16-06-2008 Types of developers
22-05-2008 documentary on Google
12-05-2008 Moonlight (Silverlight for Linux)
24-04-2008 Take Advantage of ASP.NET Built-in Features to Fend Off Web Attacks
01-04-2008 Health, Calculator , Units Conversion All in One. Very useful to all
28-02-2008 General Motors vs. Bill Gates
16-02-2008 Stealth Deployment
14-02-2008 Resignation letter of a Software Employee
12-02-2008 Development
05-05-2007 Knowledge
Wed 20 Apr 2011

If you want to have signin as different user functionality like sharepoint in your asp.net application, following workaround you might be looking for.
After setting your web.config file's 

<authentication mode="Windows" />

and in IIS after remove anonymous authentication and enable windows authentication, have following code snippet where you want to have this functionality

In your aspx page

    <div>You are logged in as <br /> <%=User.Identity.Name%> <br /><br /> 
    <asp:LinkButton ID="lnkSignOut" runat="server" Text="Sign in as different user" onclick="lnkSignOut_Click"></asp:LinkButton>


In your code behind file

 protected void Page_Load(object sender, EventArgs e)
{
    if (!this.IsPostBack)
    {
        Session["logOutRequested"] = false; //Initialize value. This will be set to true when user will click on sign in as differnet user
    }
}


protected
void lnkSignOut_Click(object sender, EventArgs e)
{
    if (null != Session["logOutRequested"] && !Convert.ToBoolean(Session["logOutRequested"])) // Check if user is clicking link first time
    {
        Session["logOutRequested"] = true; //Set value that user want to sign in as differnet user
        Response.StatusCode = 401;
        Response.StatusDescription = "Unauthorized";
        Response.End();
    }
    else
    {
        Session["logOutRequested"] = false; //Initialize value again after user is authenticated with differnet or same user again.
    }
}


Hope this workaround will help.

In case if above workaround is not working, you may try following one
www.roelvanlisdonk.nl/?p=825

 

 

 

Tags: , ,
Comments (1)
Wed 26 Jan 2011

Get-SPSite | where {$_.url -like "http://a *"}

Get-SPFarm | Format-List Id, BuildVersion, Servers, Solutions

Add-PSSnapin Microsoft.SharePoint.Powershell

===========

ExecuteHelloWorldScript from batchfile

powershell -Command "& {.\Hello.ps1}" -NoExit
pause


powershell -Command "& {Set-ExecutionPolicy bypass}" -NoExit


===========

CreateContosoSite

if($args) {
  $SiteName = $args[0]
  $SiteUrl = "http://a:3811/sites/ " + $SiteName
  Write-Host "Begin creating Contoso site at" $SiteUrl
  Write-Host
  $NewSite = New-SPSite -URL $SiteUrl -OwnerAlias Administrator -Template STS#1 -Name $SiteName
  $RootWeb = $NewSite.RootWeb
  $RootWeb.Title = "Contoso Site: " + $SiteName
  $RootWeb.Update()
  Write-Host "New Contoso site successfully created"
  Write-Host "-------------------------------------"
  Write-Host "Title:" $RootWeb.Title -foregroundcolor Yellow
  Write-Host "URL:" $RootWeb.Url -foregroundcolor Yellow
  Write-Host "ID:" $RootWeb.Id.ToString() -foregroundcolor Yellow
}
Else {
  Write-Host "ERROR: You must supply Name as parameter when calling CreateContosoSite.ps1"
}


===========

GetSharePointDlls

$path = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14"

Get-ChildItem $path -recurse |
  Where-Object {$_.name -like "*SharePoint*.dll"} |
  Sort-Object -Property Name -unique |
  Format-Table Name


===========


GetSharePointPublishingFeatures

Get-SPFeature -Limit ALL |
  Where-Object {$_.DisplayName -like "*Publishing*"} |
  Sort-Object -Property Scope
  Format-Table DisplayName, Id, Scope

 

===========

.\GetSharePointPublishingFeatures.ps1
Get-SPFarm | Format-List
Get-SPSite | where {$_.url -like "http://a *"}
.\CreateContosoSite.ps1 lab01test


===========

Comments here
Sun 30 May 2010

Query to find all the Tables and Index with number of days statistics being old. Then run Update Statistics command to update statictics for optimized query plan.

SELECT
OBJECT_NAME(A.object_id) AS Object_Name,
A.name AS index_name,
STATS_DATE(A.OBJECT_ID, index_id) AS StatsUpdated ,
DATEDIFF(d,STATS_DATE(A.OBJECT_ID, index_id),
getdate()) DaysOld
FROM sys.indexes A
INNER JOIN sys.tables B ON A.object_id = B.object_id
WHERE A.name IS NOT NULL
ORDER BY DATEDIFF(d,STATS_DATE(A.OBJECT_ID, index_id),getdate()) DESC

 

Comments here
Thu 15 Apr 2010

To view the detailed error information for generic error against 500 Internal Server Error

internal+server+error.jpg

By default, Windows hosting servers display a generic error when any .NET application generates an exception. They display a generic error because the detailed error messages allow a malicious user to obtain sensitive information.

To troubleshoot the error, you can modify your web.config file and specify that a custom error message displays. A custom error message helps you to locate the specific code that is causing the issue.

CAUTION: The code samples we provide below do not constitute a complete web.config file. Do not replace your existing web.config file with the code we provide. Before changing your web.config file, we recommend creating a backup.

 

Displaying Custom Error Messages / Enabling Detailed Errors on IIS 6

Use the sample code below to display custom error messages on IIS 6:

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>



Displaying Custom Error Messages / Enabling Detailed Errors on IIS 7

Use the sample code below to display custom error messages on IIS 7:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

 

=========================

 

Tags:
Comments here
Mon 15 Mar 2010

This post posted by Vladimir Kuzin on 15th Oct 2009. For Quick reference posted here.

Few weeks ago I was working on project which required data to be encrypted using C# and then decrypted using JavaScript. In my case JavaScript was an internal scripting language, which wasn’t exposed to public so I didn’t have to worry about people accessing encryption keys. Project objective was to encode parameter in URL preventing users from substituting it with sequential numbers.

Research:

At first I’ve decided to use symmetric algorithm and looked online for available JavaScript libraries. In my search I’ve found few AES libraries to choose form. After further analysis it was determined that most people had good luck with slowAES, and I’ve attempted to implement it. After spending some time I was unable to decrypt any data encoded with RijndaelManaged class in C#. Since I had to find solution fast I’ve moved on.

Next I’ve decided to try asymmetric encryption algorithm, and after quick research I went with RSA. After downloading most popular RSA library for JavaScript I’ve run into several issues with its implementation. I was able to use C# to decode everything what was encoded in JavaScript, but it didn’t work when data was flowing in opposite direction. After looking into the issue it appeared that JavaScript library was missing padding, however using patched versionof the library didn’t help.

Solution:

Due to lack of time I’ve decided to use simpler encryption algorithm and went with RC4. After downloading RC4 JavaScriptlibrary I’ve got it to work within minutes. Since there is no such thing as RC4 cryptographic provider in the Security.Cryptography namespace I had to use open source RC4 library.

After encrypting data I’ve also converted it to hex (base 16) in the same way as it was done on the JavaScript RC4 demo page.

Encrypting URL parameter with RC4 didn’t completely meet the objective, since it still was possible for users to use sequential numbers. Take a look at example of encrypted data below:

Input Output
10001 49845da1c0
10002  49845da1c3

Notice that only last digit of the encrypted data has changed, therefore substituting it with sequential numbers will cause an issue. To solve this I’ve added random prefix and suffix blocks to data before encrypting. Prefix and suffix blocks consisted from random letters and were anywhere between 10 and 25 characters in length. Now data looked like this:

Input:
JQNLAZXAHHSHMIL;10001;GURUOTCBBNHDCZUNFXIGKP
Output:
32e523ddb00fbf2465002bc1b4251dd12876677d47d6a 6a3101a68517dfb6a86fa525139300d65225e365a38

Every time encrypted value is changing, since it’s generated from new random data. After transferring and decrypting this data on the JavaScript side I’ve spited string by semicolon to get the actual parameter value.

I am sure there are different and possibly better solutions somewhere out there, but this one worked for my client and was implemented within a small project budget.

This is post is from original Post @ vkuzin.com/post/Passing-encrypted-data-between-C-and-JavaScript.aspx

 

Tags: , ,
Comments (3)
Fri 12 Feb 2010

SPWeb has two sharepoint cross-site group collection, SPWeb.Groups and SPWeb.SiteGroups.

SPWeb.Groups returns collection of cross-site groups which has some permission on the site. So if you add group from a site without any permission on the site, then this group wont appear in SPWeb.Groups collection, but it will appear in SPWeb.SiteGroups collection.

You can not use SPWeb.Groups.Add method to add new cross-site group, you need to use SPWeb.SiteGroup.Add method for this purpose.

In addition to this SPWeb has a property AssociatedOwnerGroup, which will return the required SPGroup. You can iterate the SPGroup users to get the list of all owners of the site.

 foreach (SPUser user in web.AssociatedOwnerGroup.Users)
 {
      // .. list all the users                        
 }

 

Finding and adding group

SPGroup  group = GetSiteGroup(web, "groupName");
if (null == group)
{
 web.SiteGroups.Add("groupName", web.AssociatedOwnerGroup, null, "Test Group description");
}

 


private static SPGroup GetSiteGroup(SPWeb web, string name)
{
    foreach (SPGroup group in web.SiteGroups)
    {
 if (group.Name.ToLower() == name.ToLower())
 {
     return group;
 }
    }
 return null;
}

 

 

Tags: , ,
Comments here
Thu 28 Jan 2010

Accessing JD Edwards Data on iSeries or AS/400 from a ASP.NET

Facing problem, while retrieving field data from JD Edwards to SQL (SSRS Reporting), giving Error or Special unicode characters,
because, the returning data was a stream that needs to be converted into ASCII (ebcdic37String) using Cp037 Encoding.


public static String convertEBCDIC37ToUnicode(String ebcdic37String)
{
 String encoding = "Cp037";
 byte[] ebcdic;
 String converted = null;
 try
 {
  ebcdic = ebcdic37String.getBytes();
  converted = new String( ebcdic, encoding );
 }
 catch (Exception e)
 {
  //Handle it
 }
 return converted;
}

 

Comments here




Ads