Please am fairly new to programming in asp.net and now am following the steps in a textbook to design an e-commerce web application.
I am using UrlRewritingNet dll from http://www.urlrewriting.net/ to create search engine friendly urls on the application. I unzipped the urlrewritingnet zip and copied its dll file to my application's bin folder. I also copied its urlrewritingnet.xsd file to my project folder. The textbook am working from uses the dll from urlrewriter.net with different configurations which I tried in my project but it didn't work. The textbook also uses visual web developer 2005. Am programming in visual studio 2012 (C#). For now am trying to rewrite the url of my catalogs page so as to test if the configuration in my web.config file is correct. I'm doing the configuration in my web.config, not in IIS. I do not want any IIS configurations because am imagining a scenario where I don't have access to the server.
I keep getting an internal server error that displays like this:
HTTP Error 500.22 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
this is the url which I want to rewrite: http://localhost:1036/Catalog.aspx?DepartmentID=1
This is my config file:
<configuration>
<configSections>
<section name="urlrewritingnet"
restartOnExternalChanges="true"
requirePermission ="false"
type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />
</configSections>
<urlrewritingnet
rewriteOnlyVirtualUrls="true"
contextItemsPrefix="QueryString"
defaultProvider = "RegEx"
defaultPage = "Default.aspx"
xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >
<rewrites>
<add name="Rule1"
provider="RegEx"
virtualUrl="^.*-d([0-9]+)/?$"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/Catalog.aspx?DepartmentID=$1"
ignoreCase="true" />
</rewrites>
</urlrewritingnet>
<appSettings>
<add key="MailServer" value="smtp.gmail.com"/>
<add key="MailUsername" value="engr.ejikeeze#gmail.com"/>
<add key="MailPassword" value="keeplooking"/>
<add key="MailFrom" value="engr.ejikeeze#gmail.com"/>
<add key="EnableErrorLogEmail" value="false"/>
<add key="ErrorLogEmail" value="engr.ejikeeze#gmail.com"/>
<add key="ProductsPerPage" value="6"/>
<add key="ProductDescriptionLength" value="60"/>
<add key="SiteName" value="BalloonShop"/>
</appSettings>
<connectionStrings>
<add name="BalloonShopConnection" connectionString="server = (local)\SQLEXPRESS; Database = BalloonShop; User = balloonshop; password=ecommerce" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<httpModules>
<add name="UrlRewriteModule"
type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
</httpModules>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/>
<customErrors mode="RemoteOnly" defaultRedirect="Oops.aspx" />
<pages theme="BalloonShopDefault">
<controls>
<add src="~/UserControls/DepartmentsList.ascx" tagName="DepartmentsList" tagPrefix="BSUC"/>
</controls>
</pages>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
Pls I need you lovely guys to help me out. Am really stuck. I've searched all round the internet for over 4 days in search of solution but to no avail. Thanks in anticipation.
You can checkout the following link:url-rewriting-in-Asp-Net
Related
I'm working with asp.net core 2.1, I launch the app on my local machine without any problem and I can debug it and open it on the browser but when I deploy it to the server I get the rediction error and I can't login.
Here is my web.config file :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false" />
</appSettings>
<location path="." inheritInChildApplications="false" allowOverride="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\BusinessAdvisor.Inventory.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
<system.web>
<trust level="Full" />
</system.web>
</location>
<system.web>
<authentication mode="None" />
<compilation defaultLanguage="c#" debug="true" />
</system.web>
<connectionStrings>
<add name="DefaultConnection" connectionString="server=localhost;user id=????_dba;password=???????;database=atechdzc_mobiserv;allowuservariables=True;persistsecurityinfo=True;SslMode=none" />
</connectionStrings>
</configuration>
<!--ProjectGuid: 5d471955-9737-4896-a960-3eb7ede4494e-->
I tried all the solutions montioned but I get the same error !
EDIT :
When I make the authentification to "Windows authentication" the error doesn't appear and if I make it as "Anonymous authentication" the error still here.
It was an error on my connection string and then the migration didn't update changes automaticaly. I fixed my connection string on appsettings.production.json and I updated the database.
For me, my IIS App pool runs under a specific account. When I had to re-create the database, I had to grant permissions to that account to the database.
I've created a web service, using vs 2017, .net 4.61. The web service works like a charm when I browse from the server using iis, but if I test on my local machine, the invoke button disappears.
I've tried adding in the following code, just above the section in the web.config file -
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
but I get an error "The configuration section 'webServices' cannot be read because it is missing a section declaration".
Where am I going wrong?
The following was added after the connectionStrings section -
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
<webServices>
<protocols>
<add name="HttpSoap12"/>
<add name="HttpSoap"/>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
I am new to VS 2013 and recently got introduced to a feature called Browser Link. I think it's an awesome feature provided by microsoft.
I am not able to get the connections.
Following steps I did
Created a new Empty MVC project
Created a controller Home and Action Index
Created a view Index.cshtml.
Solution was in debug mode.
Ran the solution.
Following is the web.config settings for the project
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
</configuration>
I have gone through the process Microsoft Explained on it's site http://go.microsoft.com/fwlink/?LinkId=313770.
To register the Page Inspector's Runtime add the following line to your web.config.
<system.web>
<compilation debug="true" targetFramework="4.5.1">
<assemblies>
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader,Version=1.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
I am getting this error:
Invalid temp directory in chart handler configuration [C:\Users\user1\Documents\Visual Studio 2010\WebSites\Website1].
Intially I was getting No http handler was found for request type ‘GET’ error which I solved.
But now I am getting the above error.
Here is my web.config,
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
</appSettings>
<system.webServer>
<handlers>
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<authentication mode="None" />
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>
Let me know what I am doing wrong.
I had the same problem and i tried everything , but nothing worked.
Till i found out that you can also use the memory for it
So you need to change:
<appSettings>
<add key="ChartImageHandler" value="Storage=file;Timeout=20;"/>
</appSettings>
to
<appSettings>
<add key="ChartImageHandler" value="Storage=memory;Timeout=20;"/>
</appSettings>
Then it will store the image in the memory.
Problem is the temporary directory. It could be because:
The directory no exists,
The user has no permission to the directory,
You are pointing to the wrong directory, or
when you move your programs form a local PC to a server you are no longer pointing to a local file, you are pointing to a URL
Solutions:
If you are using a web server, the easy and lazy solution is create a directory named temp where the aspx is located. In the same directory and give the users permission to modify.
If you are using a local PC you can use memory instead of file. No use this in the web server because is to heave for many users, but use:
<add key="ChartImageHandler" value="Storage=memory;Timeout=20;"/>
If you are using a web server, the best option is use a url instead of a file like this:
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/temp" />
You can use ~ / . or http://…
To Add permission to the ISS user, could be your user pool, windows user or any user as you used before. If you use Windows authentication, then you should grant permission to the user named “Domain Users”. Some people add permission to the user everybody. This permission should include “Modify”
i am trying to install SignalR on my Website ( Not a Web application ) (using visual studio 2012 ), when i created my website ( File--New Website ) i selected .net 4.5, my problem is when i am installing SignalR with Nuget Package this error happens
Install failed. Rolling back...
Could not install package 'Microsoft.Owin.Security 2.0.2'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.
on also in my web.config line <httpRuntime targetFramework="4.5"/> says
the targetFramework attribute is not allowed.
and my web.config is
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="KutSocialNetworkConnectionString" connectionString="Data Source=.;Initial Catalog=KutSocialNetwork;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
<appSettings>
<add key="path" value=""/>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule"
type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*"
path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
</configuration>
So it was Easy , i downloaded directly from Nuget , and also delete my webconfig and created a new One