|
I am checking if the user in in role, he is allowed access to the page. If he is not, he is shown the error message.
I have not trie User.IsInRole, somewhere I read, it give different result.
|
|
|
|
|
From what you are saying, then the User.IsInRole is what you want, as the user is already logged into the system.
|
|
|
|
|
Is
User.IsInRole faster and less expensive than
Roles.IsUserInRole
|
|
|
|
|
Ok tried it. It did work but it also took 13 seconds to execute. Note that I have tracing enabled.
|
|
|
|
|
Ok, so have you tried to profile your code and the Database.
Sounds like you have some severe latency, probably in the database on disk.
a) How many users in the user list?
b) How many roles in the roles list?
c) What sort of database are you using?
d) Is the application and the database running on the same PC? Or is it distributed? What sort of connection is between them?
e) Is their anything else that is slow in the application?
f) Are you overriding any of the base methods and trying to role your own?
These are some of the question you should be asking yourself.
Next thing to do would be create a fresh vanilla application, add a couple of users and and a couple of roles and then run the IsInRole and IsUserInRole and see what difference you get.
|
|
|
|
|
This is great advice. The fact is I have not worked a great deal with roles, profils etc and I just getting to know what providers are.
1. I have about 30 total users (max)
2. I have about 10 roles
3. SQL Server 2005
4. yes
5. No, when any page is access that has IsUserInRole, it is very slow
6. I am not overriding any function but thinking about it now.
Something to note, this application was change from time to time so it also has old users which are about the same in numbers but obviously as upgraded the program, we created new users and the old ones are still in the database.
|
|
|
|
|
Hi,
I'm Amit student of GNIIT
I want show data in gridview on my page.I have to linkbutton and one gridview.on the first linkbutton click event i'm showing a table in gridview and second linkbutton click event i also showing different table.I want if i click on linkbutton1 then gridview show blow linkbutton1 and if click linkbutton2 gridview2 show blow linkbutton2.if any person know this plz help me
thanks
Amit Kumar Gupta
|
|
|
|
|
|
Hi everyone,
i'm just writing on a server-application which contains a few HTTP-Handlers.
Now i have a Windows-Client (in future a few other clients) and want now, that only my clients are able to access those ashx-files.
Is there a simple way to secure this? Can i put something like a "certificate" in my request of the client or something else? Or should i simple encrypt my content with a asymetric key?
What do you think, any ideas?
Thank you!
|
|
|
|
|
Hi
I have created a WCF service and hosted the service as a windows service, i am able to browse from the browser like
http://localhost:8080/webservices/dataservice.svc?
when i browse i am getting the intro screen saying about svcutil.exe and generating proxies.
i have some 2 methods inside the WCF service and is running as a windows service.when i make a call to the service in order to call and execute the function inside it , i am not getting any reply but always it shows the intro screen with metadata.
How to call the method inside windows service(WCF service as windows service)
method call from browser
http://localhost:8080/webservices/dataservice.svc/GetQuote
procedure created to make wcf as winservice
public class ServiceProjectInstaller:ServiceBase
{
public ServiceHost serviceHost = null;
public ServiceProjectInstaller()
{
ServiceName = "WCFService";
}
public static void Main()
{
ServiceBase.Run(new ServiceProjectInstaller());
}
protected override void OnStart(string[] args)
{
TraceWinService("Starting a Service");
Timer timer = new Timer();
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
timer.Interval = 60000;
timer.Enabled = true;
if (serviceHost != null)
{
serviceHost.Close();
}
serviceHost=new ServiceHost(typeof(myService.dataService.CDataService));
serviceHost.Open();
}
private void OnElapsedTime(object source, EventArgs e)
{
TraceWinService("Another Event at: " + DateTime.Now);
}
protected override void OnStop()
{
if (serviceHost != null)
{
serviceHost.Close();
serviceHost = null;
}
}
private void TraceWinService(string content)
{
FileStream fs = new FileStream(@"d:\ScheduledService.txt", FileMode.Open, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.BaseStream.Seek(0, SeekOrigin.End);
sw.WriteLine(content);
sw.Flush();
sw.Close();
}
private void InitializeComponent()
{
}
}
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
private ServiceProcessInstaller process;
private ServiceInstaller service;
public ProjectInstaller()
{
process = new ServiceProcessInstaller();
process.Account = ServiceAccount.LocalSystem;
service = new ServiceInstaller();
service.ServiceName = "WCFService";
service.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
Installers.Add(process);
Installers.Add(service);
}
}
config file
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ICDataService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/WCFService/dataservice.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IClickDataService"
contract="Dvmwebservices.IClickDataService" name="WSHttpBinding_IClickDataService">
<identity>
<servicePrincipalName value="host/ac.sdwe.sw.co.in" />
</identity>
</endpoint>
</client>
<services>
<service name="myService.CService.CDataService" behaviorConfiguration="CDataServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/WCFService/dataservice.svc"/>
</baseAddresses>
</host>
<!-- This endpoint is exposed at the base address provided by the host: http:
<endpoint address="" binding="wsHttpBinding" contract="myService.CService.ICDataService"/>
<!-- the mex endpoint is exposed at http:
To expose the IMetadataExchange contract, you
must enable the serviceMetadata behavior as demonstrated below -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior name="ClickDataServiceBehavior">
<!-- The serviceMetadata behavior publishes metadata through
the IMetadataExchange contract. When this behavior is
present, you can expose this contract through an endpoint
as shown above. Setting httpGetEnabled to true publishes
the service's WSDL at the <baseaddress>?wsdl
eg. http://localhost/servicemodelsamples/service.svc?wsdl -->
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
After coding the above build and deployed the .exe as service using InstallUtil tool present in vs2010.
i want to know how to call services method from browser.
|
|
|
|
|
Satish_S wrote: call services method from browser
AFAIK you can't
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
how to restrict access to a web application just for mobile terminals,( not having access from a pc)
thinks
|
|
|
|
|
I use the following code snipet to determine if a user is visiting my web page from a Blackberry. (the default mobile device supported by my orgainization)
I believe this would work to detect any mobile deveice.
If (Request.Headers("X-Wap-Profile").ToString().Length > 0) Then
End If
Good luck.
|
|
|
|
|
thinks a lot
but i'm testing this code:
bool IsMobi = false;
if (Request.Headers["X-Wap-Profile"] != null)
{
Response.Redirect("erreur.aspx", true);
}
else {
if (Request.Headers["X-Wap-Profile"].ToString().Length > 0)
{
IsMobi = true;
Response.Redirect("login.aspx", true);
}
else
{
Response.Redirect("erreur.aspx", true);
}
}
}}
but he dosen't work correctly, i detect that "Request.Headers["X-Wap-Profile"] != null"
is null, i testing from a pda hp and o mobile
|
|
|
|
|
Are you sure that Request.Headers["X-Wap-Profile"] returns null , when X-Wap-Profile is not set? Actually, we could expect it to do so, but I'd prefer to include an empty string as a possible return value. Hence, replace
if (Request.Headers["X-Wap-Profile"] != null)
by
if (!string.IsNullOrEmpty(Request.Headers["X-Wap-Profile"]))
|
|
|
|
|
thinks for your reply.
yes i'm sure that returns null , and also your proposition returns null, this is the code used in my form load:
bool IsMobi = false;
if (!string.IsNullOrEmpty(Request.Headers["X-Wap-Profile"]))
{
if (Request.Headers["X-Wap-Profile"].ToString().Length > 0)
{
IsMobi = true;
Response.Redirect("erreur.aspx", true);
}
else
{
Response.Redirect("login.aspx", true);
}
} }
|
|
|
|
|
Hello,
I am having a challenge of using jQueryAutoComplete in my webforms. The problem is when I have selected an item from the suggested items in the textbox, fill other form fields as required, then submits the form, every is fine. But I cannot get the autocomplete working anylonger to process a new entry. What could have been the course of this? See how I did it
<link rel="stylesheet" type="text/css" href="../../Styles/jquery.autocomplete.css" />
<script src="../../Scripts/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/jquery-1.4.1.min.js"></script>
<script src="../../Scripts/jquery.autocomplete.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=staffNameTextBox.ClientID%>").autocomplete('../../AutoSuggest/SuggestStaffName.ashx');
});
</script>
|
|
|
|
|
Will it work after you refresh the page manually?
|
|
|
|
|
No. It only works once and after postback, it stops working
|
|
|
|
|
The Dom wasn't ready after the postback, thus the conditional statement which roughly states
if DOM is ready then run autocomplete.
$(document).ready(function () {
I suspect that you loaded your JQuery in the wrong section, probably needs to be inside the body or form tags, at the bottom after the textbox objects are created, so the Jquery has something to attach to.
|
|
|
|
|
Okay, I will try your suggestion.
Thanks.
|
|
|
|
|
You point to JQuery or any other JQuery add-on in the head tag
<head>
<script "/Jquery/Jquery.js" />
</head>
<body>
<form>
<script>
</script>
</form>
</body>
|
|
|
|
|
Hi
I am Using .Net framework 4.0 and Ajax 4.1.50401.0
I have ModalPopup inside update panel with properties Drag="true"
, when user click on blank area of panel, I am getting java script runtime error like” Microsoft JScript runtime error: Unknown runtime error”.
Please refer the below statements for more clarification.
_onDragStart: function(ev) {
window._event = ev;
document.selection.empty();
var dt = ev.dataTransfer;
if (!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;
var dataType = this._activeDragSource.get_dragDataType().toLowerCase();
var data = this._activeDragSource.getDragData(this._activeContext);
if (data) {
if (dataType != "text" && dataType != "url") {
dataType = "text";
if (data.innerHTML != null) {
data = data.innerHTML;
}
}
dt.effectAllowed = "move";
dt.setData(dataType, data.toString());
}
},
|
|
|
|
|
Please send me the markups that represent the ModalPopupExtender , the target control, the popup control and the UpdatePanel .
Help people,so poeple can help you.
|
|
|
|
|
I am using paypal sandbox to doing testing, however after click the continue button that i wish to complete the transaction, but the page is keep loading. So i click to go back on the browser, and then click to go forward again, then it will only display "You've already completed your purchase. Please click Close to continue to the merchant." My problem is i want it auto return me the success page, but not click the back and forward to view the return to merchant. thanks you very much and appreciate your answer.
The page keep loading URL
https:
|
|
|
|