 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
Hi
I am currently using Comm100 to chat with site's visitors but i want to ask if there is a better & free chat system to integrate with an asp.net website?
Thanks,
Jassim
|
|
|
|
 |
|
 |
I have 6 user controls on .aspx page and i have a button on .aspx page and all the user controls in update panel with updatemode conditional and each user control in Update panel, when i click on button , i need to referesh fisrst usercontrol.
Regards,
Vishnu.
|
|
|
|
 |
|
 |
Programmatically from within the application that is.
I know how to check it manually.
|
|
|
|
 |
|
 |
Are you using IIS 7 (or greater)? If so, you can use the Microsoft.Web.Administration namespace to get direct access to IIS.
|
|
|
|
 |
|
 |
Pete O'Hanlon wrote: Are you using IIS 7
Not necessarily, but probably in most cases. So that's a good starter.
|
|
|
|
 |
|
 |
This is the New Development for our product. our requirement is, DAL -- can be Ms Acccess or sql server [later may be cloud(azue db)] How can i swich between this db based on web.config so please suggest best method , I can check in BLL , Is this a right method? Ramkumar ("When you build bridges you can keep crossing them. ") http://ramkumarishere.blogspot.com
|
|
|
|
 |
|
 |
Having multiple connections in your configuration file is easy -
<connections>
<connection id="FirstConnection">
<databasename>A</databasename>
<servername>SERVER1</servername>
<integratedSecurity>True</integratedSecurity>
</connection>
<connection id="SecondConnection">
<databasename>A</databasename>
<servername>SERVER1</servername>
<integratedSecurity>True</integratedSecurity>
</connection>
</connections>
You can make the choice of connections in the DAL or the BAL layer.
I would think DAL is better because then the BAL is completely free from the decision of which database to connect to - which is the way it should be.
A pattern called the Enterprise Library supports multiple types of databases via some patterns.
|
|
|
|
 |
|
 |
While debugging my slow application, I found the culprit is
Roles.IsUserInRole
It take from 3 sec to 9 second to execute. I found the reason it through the entire user list and calls other function, but it shouldn't be that slow to what I understand.
My question is can it be made faster?
|
|
|
|
 |
|
 |
Your could implement a custom Role Provider[^] - I do - and then the responsibility is yours. Mine works by using a enum in the user info, so it is one access to the DB at most (normally none since the user profile is already downloaded).
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
 |
|
 |
Are you trying to determine if the current logged in user is in a role, i.e. for customising a page view?
Have you tried using User.IsInRole against Roles.IsUserInRole?
Don't know what you are doing, but the User. method should not need to iterate the entire user list (unless the inner working of the membership provides end up doing the same thing).
|
|
|
|
 |
|
 |
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://localhost:8080/WCFService/dataservice.svc -->
<endpoint address="" binding="wsHttpBinding" contract="myService.CService.ICDataService"/>
<!-- the mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex
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.
|
|
|
|
 |