Showing posts with label classic asp. Show all posts
Showing posts with label classic asp. Show all posts

Saturday, February 4, 2017

Function FixForHTML(tmpText1)
if ( not tmpText1 is nothing and tmpText1 <> "") then
    Dim tmpText2
    tmpText2 = tmpText1
    tmpText2 = Replace(tmpText2,Chr(13),"</p><p>" )
    tmpText2 = Replace(tmpText2,Chr(9),"&#xa0;&#xa0;&#xa0;&#xa0;")
tmpText2 = Replace(tmpText2,Chr(10),"&#xa0;&#xa0;&#xa0;&#xa0;")
    FixForHTML = tmpText2
else
FixForHTML = tmpText1
end if
End Function

Sunday, October 16, 2016

Enable Windows Authentication and disable Anonymous authentication in IIS.


If windows authentication option is not there then you have to enable it by following steps:



Once it is enables Browsers will start prompting for ldap/windows credentials.

Which is fine for internet. But If you want to set up intranet site and do not want user to be prompted for credentials, You have to do some browser settings as follows:

For Internet explorer :

Settings > Internet Options > Security 



Add your site to local interanet, IE will stop asking for credentials.

For FF You can do setting in about:config url and add sites in NTLM  "network.automatic-ntlm-auth.trusted-uris". 

If that seems tuff You can install a small plugin from "https://addons.mozilla.org/en-US/firefox/addon/integrated-auth-for-firefox/" and add your site url there.

Window / ldap username can be retrieved from server variables as follows in asp:

Request.ServerVariables("LOGON_USER")
Request.ServerVariables("auth_user")
Request.ServerVariables("REMOTE_USER")

happy coding :)




Saturday, October 8, 2016

You would need to replace vb carriage return with br tag, Following is the function which can solve all your purpose:

Function Escape(sString)
strReturn = sString
  if(len(sString) > 0) then
    'Replace any Cr and Lf to <br>
    strReturn = Replace(sString , vbCrLf, "<br>")     : 'visual basic carriage return line feed     ***********\
    strReturn = Replace(strReturn , vbCr , "<br>")     : 'visual basic carriage return               *********These 3 are line breaks hence <BR>
    strReturn = Replace(strReturn , vbLf , "<br>")     : 'visual basic line feed          ***********/
    strReturn = Replace(strReturn, "'", "\'")          : 'Single quote changed to 2 single quotes ASP knows what to do
end if
    Escape = strReturn
End Function
Powered by Blogger.

Followers

Best Price Amazon Portal

Amazon Best Offers