Monday, December 10, 2012

How To Enable Remote Access To MySQL Server on Windows Server



  1. Go to the Start Menu and select Run to open a Command Prompt
  2. Browse to the MySQL bin directory. I had to do
    C:>CD "Program FilesMySQLMySQL Server 4.1bin"
    Keep in mind that your directory structure might differ from mine depending on how you installed MySQL. Also you may have to do a few “Clear Directories” (i.e. “CD” or CD..) to get to the base of C:>.
  3. Type in:
    mysql -u root -p
    and enter in your root password when prompted.
  4. If you logged in successfully, you should see:
    mysql>
    and if not, then you will get something like:
    ERROR 1045 (28000): Access denied for user 'blah'@'localhost' (using password: YES)
  5. Enter in
    GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'IP' IDENTIFIED BY 'PASSWORD';
    What this will do is create a new user with ROOT privileges, so be very careful what account you are creating. If you are just using the root account, then replace USERNAME with root. And just so we are clear, USERNAME is the account you wish to create or use. IP is the physical IP address of the computer you wish to grant remote access to. If you enter ‘%’ instead of an IP number, that user will be able to remote access the MySQL server from any computer. PASSWORD is the password you wish to create if it’s a new user or the existing password of an existing account. And yes, you need to use the single quotation.
  6. And finally, you want to run this last command:
    mysql> FLUSH PRIVILEGES;
  7. To exit, just type:
    mysql> quit;

Thursday, August 16, 2012

How to redirect from HTTP to HTTPS in ASP.NET

If you are a web developer and want to make an online shopping site, you will definitely asked to use SSL and use HTTPS request. Now the linked question in your mind is How do i redirect request from HTTP to HTTPS?

Here is the simple solution.

Go to Web.Config file and add below code stuff.

<rewrite>

  <rules>

    <rule name="Redirect to HTTPS" stopProcessing="true">

      <match url="(.*)" />

      <conditions>

        <add input="{HTTPS}" pattern="^OFF$" />

      </conditions>

      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />

    </rule>

  </rules>

</rewrite>

That's great your all request are now redirect to HTTPS. Wait this may not be happened with all the guys. Please make sure you have installed the URL Rewrite Module 2.0 available here.  If it is not installed and you try above code it will make your web.config file invalid and raise error.

After installing Rewrite Module 2.0 restart the IIS and your url redirect will start working.

Saturday, July 21, 2012

How to prevent browser caching for css / javascript

Now a days i have an online shopping site for maintenance.
https://www.izabellondon.com
Since i have done lots of changes in the site, there are situations when we upload new css or javascript but client can not see the new changes because by default browser loads the css or javascript file from its cache memory if the URL is repeated. 


Then we have to ask our client to please clear your browser cache to get new changes. I am sure many of web developer has to face this situation then i decided not to ask our client for same thing.


I start wondering how to overcome this problem? after some google search i found the solution.


You need to add any random querystring after your call to javascript or css includes. for example.


CSS
<link href="/App_Templates/FrontEnd/Login.css?date=2012-07-02" rel="stylesheet" type="text/css" />


Javascript
<script src="/Content/swfobject.js?version=2" type="text/javascript"></script>


It will resolve the issue and your client will not need to clear the cache to get new changes. Querystring in css/javascript call will always load file from the server instead of browser cache.


:)


wow


Happy Coding :)

Wednesday, April 18, 2012

SEO friendly URL (extensionless URL) not working in IIS 7

Currently i am working on a project in which i need to implement SEO friendly URLs. I done it and works fine in development server but when i tried to upload all stuffs on server and send request for SEO friendly URLs i found it gives me error 404 resource not found.

System configuration is
Windows Server 2008
IIS7
ASP.NET 4.0.30319


Solution is here,

Follow the steps:

1) Go to IIS and site application pool set to classic instead of integrated (Managed pipeline mode:).
2) Go to your site in IIS and open "Handler Mapping" section and add a "Wildcard Script Map..." Request path = * and Executables = 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
3) Restart your IIS and run your site.

Happy Coding :)

Wednesday, September 14, 2011

Saving changes is not permitted in SQL 2008 Management Studio

I am working on one of my project and i need to change the table design for change requirement, i done the changes and tried to save the table but SQL server throws an error message as described below:

"Saving changes is not permitted. The changes you have made require the following table to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created."

How to solve this issue?

  1. Go to Tools > Options it will open the Options dialog.
  2. Select the Designers from left pane
  3. Un check the Prevent saving changes that require table re-creation
  4. Press OK button.













This will allow you to save the table changes.

Possible causes for this error:

  1. You tried to change the data type of any column and the table already have some data exists.
  2. You tried to add constraint to any column like Primary key which already have data exists.
thanks and regards.



Monday, June 6, 2011

Visual Studio crashing when opening XAML (WPF) files

Before some months i develop one project in WPF, now i got new requirements from client i start working on that change but what i see when i try to open XAML visual studio crashed. I was shocked what happened because few months ago everything was fine.

I did lots of goggling to solve the issue, believe me i search for 2 days. finally i found a solution here

what you need to do is run the visual studio command prompt and enter "ngen/ delete *" (exclude the quotes). it will remove all assemblies native images. It will remove corrupted assemblies too.

It worked for me.
Thanks to Pale Musings.

Tuesday, March 8, 2011

How to use Session variable in Asp.net web service

In order to use Session variable in asp.net web service you need to add
EnableSession=true attribute in web method definition.

[WebMethod(EnableSession=true)]
public void HelloUser()
{
return "Hello " + Convert.ToString(Session["LoggedInUser"]);
}