Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 create user id which can be access only thru iis

Author  Topic 

rajkblr79
Starting Member

1 Post

Posted - 2011-02-10 : 16:24:28
I need to know is there anyway we can create a user id, which will be accessbile only through my application siting in iis, not through any other way. Even through SQL Management studio the user id should not able to login.
only through application the user id should allow to login

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-02-11 : 04:19:02
Well...you can do it with a DDL trigger, there is an event for logons:
http://msdn.microsoft.com/en-us/library/ms189799.aspx#CodeSpippet7

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-02-11 : 04:26:02
This would probably work (untested):
CREATE TRIGGER dropDisallowedLogins
ON DATABASE
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN()= 'myIISlogin' AND CHARINDEX('IIS', APP_NAME()) = 0 --> You need to change "IIS" to the actual APP_NAME
ROLLBACK;
END


- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page
   

- Advertisement -