|
first of all thank you very much sir for your response.
sir i want to design a web page where from anyone can ask any question of any subject for eg maths.
suppose someone want to ask about solution for (a+b)2 [a plus b whole square] then how he/she can type 2 as superscript, and other symbols like integration, differentiation etc.
|
|
|
|
|
You cannot type those symbols on a standard keyboard, without using multiple keystrokes, which are difficult to remember. You should use the standard operator symbols as defined in most modern programming languages, e.g. 7.2.1 Operator precedence and associativity (C#)[^]. For subscript and superscript on web pages see HTML sub tag[^].
|
|
|
|
|
okay sir, can you tell me how to upload and retrieve videos using ASP.Net
|
|
|
|
|
Google will find many samples and tutorials for you.
|
|
|
|
|
|
i want to connect to my local database but it doesn't responding means some thing is going wrong.
please advised me for the syntax of as i wrote the below code.
<connectionstrings>
<add name="connect" connectionstring="Data Source=DESKTOP-L6ABJBC;Initial Catalog=LoginDB1;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebSite3-20170707151050.mdf">
|
|
|
|
|
If you want someone to help you resolve an error, then first you need to tell us what the error is. Just saying "it's not responding" and "something is going wrong" is not enough information for anyone to help you.
The only obvious problem is that you're using AttachDBFilename , but you don't appear to be connecting to an instance of SQL Server Express. That option only works with Express, and is a bad idea anyway:
Bad habits : Using AttachDBFileName - SQL Sentry[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
 Brother this is error showing in this way "Line no. 22 con.open();
Server Error in '/' Application.
Database 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\LoginDB1.mdf' already exists. Choose a different database name.
Cannot attach the file 'C:\Users\Atta\Documents\Visual Studio 2012\WebSites\WebSite3\App_Data\aspnet-WebSite3-20170707151050.mdf' as database 'LoginDB1'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Database 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\LoginDB1.mdf' already exists. Choose a different database name.
Cannot attach the file 'C:\Users\Atta\Documents\Visual Studio 2012\WebSites\WebSite3\App_Data\aspnet-WebSite3-20170707151050.mdf' as database 'LoginDB1'.
Source Error:
Line 20: {
Line 21: SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connect"].ToString());
Line 22: con.Open();
Line 23: string query = "select count(*) from userlogin where username ='" + txtBox1.Text + "'and pass '" + txtBox2.Text + "'";
Line 24: SqlCommand cmd = new SqlCommand(query, con);
Source File: c:\Users\Atta\Documents\Visual Studio 2012\WebSites\WebSite3\Default2.aspx.cs Line: 22
Stack Trace:
[SqlException (0x80131904): Database 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\LoginDB1.mdf' already exists. Choose a different database name.
Cannot attach the file 'C:\Users\Atta\Documents\Visual Studio 2012\WebSites\WebSite3\App_Data\aspnet-WebSite3-20170707151050.mdf' as database 'LoginDB1'.]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +821
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +332
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +699
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217
System.Data.SqlClient.SqlConnection.Open() +96
Default2.Button1_Click(Object sender, EventArgs e) in c:\Users\Atta\Documents\Visual Studio 2012\WebSites\WebSite3\Default2.aspx.cs:22
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9819334
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
|
|
|
|
|
|
How do I build an XML based News page in ASP.NET MVC? I would like to enumerate XML files inside a folder and build a list of summaries on the page. Once the visitor clicks on one of the summaries, I would like to load the associated XML file and render the full news content (with nice formatting included).
An example of the summaries page can be found [1] while and example of the single XML news page rendered can be found here [2]?
Should I write everything from scratch or there is a good tutorial to start with somewhere?
Thanks.
[1]:https://www.devexpress.com/Home/Announces/2017-Universal-17-1.xml
[2]:https://www.devexpress.com/Home/Announces/
|
|
|
|
|
It depends on the structure of the XML files. Do they all share the same structure? If not, how do you identify which structure each file has?
If they're RSS or Atom feeds, the SyndicationFeed[^] class is probably the best place to start:
Build an RSS reader in 5 minutes | Thomas Levesque's .NET blog[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
XML file will be manually created by us and they should support formatting in some way. As you can see from the links, this News are nicely formatted (I mean titles, sub-titles, etc.)
Thanks.
|
|
|
|
|
We are getting complaints from the customer that they have to keep on refresh (Ctrl+F5) on the page or sometimes clear the cookies to reflect the changes done on upgrade.
Especially, when we upload CSS/JS files or Images sometimes.
To overcome this situation, I did some research and found one solution to append Query string with the name of image or CSS files. But it does not seem to be a coherent solution. Then I used NuGet packages for Bundle. It seems to be the solution but I have another issue like I am calling individual CSS file for each page (page specific) and to make a bundle for the single file is not the good idea.
What should i follow as good approach to overcome this situation where changes can reflect on the server after uploading CSS/Images or JS files.
|
|
|
|
|
You've already mentioned it, a querystring variable on the css\js paths.
|
|
|
|
|
Should I go with this option only?
|
|
|
|
|
|
Okay, I will opt the same.
Thanks
|
|
|
|
|
Mads Kristensen wrote a blog post explaining how to do this back in 2014: Cache busting in ASP.NET[^]
However, I'd be inclined to use the query-string rather than a fake path. It's a fairly simple change:
using System;
using System.IO;
using System.Web;
using System.Web.Caching;
using System.Web.Hosting;
public class Fingerprint
{
public static string Tag(string rootRelativePath)
{
if (string.IsNullOrWhiteSpace(rootRelativePath)) return string.Empty;
if (rootRelativePath[0] != '~')
{
rootRelativePath = "~" + rootRelativePath;
}
string result = HttpRuntime.Cache[rootRelativePath] as string;
if (result == null)
{
string absolute = HostingEnvironment.MapPath(rootRelativePath);
DateTime date = File.GetLastWriteTime(absolute);
result = rootRelativePath + "?v=" + date.Ticks;
HttpRuntime.Cache.Insert(rootRelativePath, result, new CacheDependency(absolute));
}
return result;
}
}
<link rel="stylesheet" href="@Fingerprint.Tag("~/content/file.css")" />
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Wasn't there some other setting that automatically forces updates the CSS?
|
|
|
|
|
Only if you disable caching on the files, which will degrade the performance of your site.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This is a nice ASP.NET UrlRouting tool I have ever tried nowadays. I developed an asp.net web form app using this tool. It's great working my local IIS. If I deploy to my web hosting, it's giving an error about SecurityPermission. Please help me!
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal(String virtualPath, IPrincipal user, String verb) +42
Microsoft.AspNet.FriendlyUrls.Abstractions.UrlAuthorizationModuleWrapper.CheckUrlAccessForPrincipal(String virtualPath, IPrincipal user, String verb) +14
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetWebObjectFactory(HttpContextBase httpContext, String modifiedVirtualPath) +159
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.Resolve(HttpContextBase httpContext, IList`1 extensions, String virtualPathOverride, IFriendlyUrlRouteSupportFunctions supportFunctions) +220
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.Microsoft.AspNet.FriendlyUrls.Abstractions.IFriendlyUrlRouteSupportFunctions.Resolve(HttpContextBase httpContext, IList`1 extensions, String virtualPathOverride) +16
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetRouteData(HttpContextBase httpContext, String pathOverride, IFriendlyUrlRouteSupportFunctions supportFunctions) +140
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetRouteData(HttpContextBase httpContext, String pathOverride) +9
Microsoft.AspNet.FriendlyUrls.FriendlyUrlsModule.RedirectToFriendlyUrl(HttpContextBase httpContext, IFriendlyUrlRoute route, IVirtualPathUtility virtualPathUtility) +346
Microsoft.AspNet.FriendlyUrls.FriendlyUrlsModule.<Init>b__0(Object sender, EventArgs e) +171
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
|
|
|
|
|
|
often we attach role with action like below way
[Authorize(Roles = "Admin, SuperUser")]
[Authorize(Users="Jacquo, Steve", Roles="Admin, SuperUser")]
Users : Comma-separated list of usernames that are allowed to access the action method.
Roles : Comma-separated list of role names. To Access the action method, users must be in at least one of these roles.
[Authorize(Roles = "Producer")]
[Authorize(Roles = "Admin")]
public ActionResult Details(int id) {
}
now see authorize and role name is hard coded with action method. suppose action Details is associated with admin role which is hard coded but how could i attach more role to details action or remove any role from details action at run time. i guess it is not possible because asp.net mvc not providing anything built in.
i search google to see that anyone does it anything such as what i am looking for. unfortunately found no similar write up.
so i need some guidance that how could i develop a UI from where admin can associate role with action instead of hard coding at development time.
so tell me your think how could i associate a role or multiple roles with action from a custom UI.
also tell me how could i check at run time that user has that role when user try to access a specific action.
please discuss in details for designing this part what i am looking for. still it is not clear to you what i am looking for then tell me i will try to explain the same in more details.
thanks
|
|
|
|
|
I think these can't be dynamic due to the fact that .net only inistialises the attribute the once and as the valid roles\users are set on initialisation they are set forever once created. To do what you want to do you'll probably need to write your own validation attribute that gets the list of valid users\roles from some other location rather than the attribute parameters. I'm sure if you google for how to override the default validation attributes, or how to write your own you'll find some sample code, they're fairly straight-forward.
|
|
|
|
|
Hi,
does anyone have a simple ASP.NET code snippet that accepts a internal Windows user name as a parameter and can retrieve the real name (first and last name) and the user group membership via LDAP?
Are there any spcial pre-requisites to implement this or
can this be done with built in ASP.NET means?
Thanks Dirk
|
|
|
|
|